【发布时间】:2017-06-27 18:18:53
【问题描述】:
我的布局设置如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/my_toolbar" />
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.my.SubView
android:id="@+id/my_list_subview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white" />
</android.support.v4.widget.SwipeRefreshLayout>
<TextView
android:id="@+id/text_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/padding_medium"
android:layout_margin="@dimen/padding_medium"
android:text="Hello"
android:textSize="14sp"
android:maxLines="3"/>
</LinearLayout>
问题是 SwipeRefreshLayout 占据了整个屏幕,而 textview 根本不显示。
上图中的蓝线是文本视图所在的位置。有什么我想念的吗?这似乎是一个如此简单的问题,太可笑了!
【问题讨论】:
-
尝试使用 layout_above 从下到上构建布局。
-
不,不起作用。在任何一种情况下,滑动刷新布局都希望占据整个空间直到底部。如果我将 textview 向上移动,它会正确显示,但不会在下方显示。
-
做一件事,将父布局高度作为match_parent。
-
而且它可能只是在预览,尝试运行应用程序?
-
也试过调整高度。 (下面的编辑和答案)。
标签: android swiperefreshlayout