我的布局设置如下:
<?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 根本不显示。
上图中的蓝线是文本视图所在的位置。我有什么遗漏的吗?这看似简单的问题,却是可笑!
Image 2 in response to the answer by @Tomar![enter image description here](https://i.stack.imgur.com/w0CZc.png)
try this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/my_toolbar"
android:id="@+id/top_layout"/>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_above="@+id/text_content"
android:layout_below="@+id/top_layout"
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:layout_alignParentBottom="true"
android:maxLines="3"/>
</RelativeLayout>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)