【发布时间】:2017-09-19 07:02:26
【问题描述】:
我有一个布局对话框
subject_view.xml
<?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="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<TextView
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"
android:text="Subject"
android:textSize="18sp"
android:textColor="@color/black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/subject_name"/>
<LinearLayout
android:weightSum="2"
android:gravity="end"
android:layout_below="@id/subject_name"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ViewSwitcher
android:layout_weight="1"
android:layout_marginTop="8dp"
android:layout_below="@id/subject_name"
android:id="@+id/switcher"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_gravity="center"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:paddingLeft="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/please_wait"/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:layout_marginTop="10dp"
android:id="@+id/studentRecycler"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
</ViewSwitcher>
<Button
android:layout_weight="1"
android:layout_below="@id/switcher"
android:layout_alignParentRight="true"
android:id="@+id/ok_Btn"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:background="@drawable/blue_button"
android:text="ok"
android:textColor="#fff"/>
</LinearLayout>
</RelativeLayout>
创建对话框后,我正在从服务器获取数据以填充 RecyclerView。那时 ViewPager 的第一个孩子(带有进度条)是可见的。当我从服务器获取数据时,我将 RecyclerView 设置为可见子项。
这里的问题是,当 RecyclerView 有很多行时,ViewSwitcher 下包含 RecyclerView 的按钮只有部分可见(比如,三分之一的按钮不可见)。
屏幕截图(不应该是这样的)
但是当 recyclerView 没有那么多行时,它会按预期显示,
屏幕截图(它的外观)
我该如何解决这个问题?
【问题讨论】:
-
如果您的姓名列表通常很长,那么
BottomSheet可能比Dialogdeveloper.android.com/reference/android/support/design/widget/… 更合适 -
从
30dp中删除身高和体重,并将其设为wrap_content。 -
@sushildlh 按钮的重量?
-
是的......
-
@Kuffs 我已经在同一个活动中使用过底页一次(看看第二个屏幕截图)。我认为从该底片创建另一个底片是不可取的
标签: android android-layout android-recyclerview