我正在使用 RecyclerView
和底部按钮对应用程序进行编程。 RecyclerView
由我从服务器获取的图像填充。顶部栏已固定
RecyclerView代码
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
RecyclerView 正在由 ImageView 填充
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:layout_marginBottom="1dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginTop="1dp" />
不可见的按钮代码
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<ru.noorsoft.rubkoff.HeButton
android:id="@+id/button1"
style="@style/leftButStyle"
android:layout_width="wrap_content"
android:layout_height="55dp"
android:layout_weight="1"
android:gravity="center"
android:textAllCaps="false"
android:textColor="@color/colorBlue"
android:textSize="20sp" />
<ru.noorsoft.rubkoff.HeButton
android:id="@+id/button2"
android:background="@android:color/transparent"
android:layout_width="wrap_content"
android:layout_height="55dp"
android:layout_weight="1"
android:textColor="@color/colorBlue"
android:textAllCaps="false"
android:textSize="20sp" />
<ru.noorsoft.rubkoff.HeButton
android:id="@+id/button3"
style="@style/rightButStyle"
android:layout_width="wrap_content"
android:layout_height="55dp"
android:layout_weight="1"
android:textColor="@color/colorBlue"
android:textAllCaps="false"
android:textSize="20sp" />
</LinearLayout>
最佳答案
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- here goes the header -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="header"/>
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:listitem="@android:layout/simple_gallery_item"
android:layout_below="@id/header"
android:clipToPadding="false"
android:paddingBottom="55dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:weightSum="3">
<ru.noorsoft.rubkoff.HeButton
android:id="@+id/button1"
style="@style/leftButStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:textAllCaps="false"
android:textColor="@color/colorBlue"
android:textSize="20sp" />
<ru.noorsoft.rubkoff.HeButton
android:id="@+id/button2"
android:background="@android:color/transparent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:textColor="@color/colorBlue"
android:textAllCaps="false"
android:textSize="20sp" />
<ru.noorsoft.rubkoff.HeButton
android:id="@+id/button3"
style="@style/rightButStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:textColor="@color/colorBlue"
android:textAllCaps="false"
android:textSize="20sp" />
</LinearLayout>
</RelativeLayout>
关于android - recyclerview下的按钮不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40004120/