Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – RecyclerView位于工具栏下方大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
问题:我在CoordinatorLayout中有一个RecyclerView和一个工具栏.
RecyclerView位于工具栏下方,但不应该.

android – RecyclerView位于工具栏下方

问题:如何实现RecyclerView和工具栏有一个边框?

activity_main.xml中

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://scheR_209_11845@as.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://scheR_209_11845@as.android.com/apk/res-auto"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar">

    <include
        android:id="@+id/toolbar_main"
        layout="@layout/toolbar"></include>

    </android.support.design.widget.AppBarLayout>

    <FrameLayout
        android:id="@+id/maschinelistcontainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</android.support.design.widget.CoordinatorLayout>
@H_893_6@maschine_fragment.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://scheR_209_11845@as.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:cliPTOPadding="false"
        android:scrollbars="vertical" />

</LinearLayout>

解决方法

将您的代码更改为:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://scheR_209_11845@as.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://scheR_209_11845@as.android.com/apk/res-auto"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar">

    <include
        android:id="@+id/toolbar_main"
        layout="@layout/toolbar"></include>

    </android.support.design.widget.AppBarLayout>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layouT_Behavior = "@String/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>

大佬总结

以上是大佬教程为你收集整理的android – RecyclerView位于工具栏下方全部内容,希望文章能够帮你解决android – RecyclerView位于工具栏下方所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。