android - recyclerview下的按钮不可见

标签 android android-recyclerview

我正在使用 RecyclerView 和底部按钮对应用程序进行编程。 RecyclerView 由我从服务器获取的图像填充。顶部栏已固定

http://joxi.ru/KAxee4XTEMpPr8

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/

相关文章:

android - RecyclerView 中的无限滚动

java - 如何在RecyclerView Adapter类中初始化正确的TextView?

android - 如何使用 RecyclerView 和 LinearLayoutManager 将项目显示在顶部,而不管项目数量如何?

android - 将 gridview 替换为 recyclerview

android - ExoPlayer:处理延迟加载播放列表的最佳方法是什么?

android - 动态获取字符串值

android - 如何自定义单个选项卡? (更改背景颜色、指示器颜色和文本颜色)

android - 如何从 Google Play 控制台禁用暂停订阅?

android - 如何在灵活的应用内更新 android 中下载完成时收到通知?

android - 在启动器应用程序上向上和向下滑动手势