我正在尝试将EditText放在listview之上,但我不明白为什么listiview与编辑文本重叠。这是布局源:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10dp"
>
<RelativeLayout
android:id="@+id/firstlayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<TextView
android:id="@+id/textEnter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello" />
<EditText
android:id="@+id/editTextInput"
android:layout_below="@+id/textEnter"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/sw_refresh"
android:layout_width="match_parent"
android:layout_height="fill_parent">
<!--layout which should be refreshed should come here-->
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:listSelector="@drawable/list_selector"
android:background="@drawable/customshape"
android:fadeScrollbars="false"
>
</ListView>
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>
我已经尝试了一切在我脑海中的想法,在Android Studio设计器中出现了布局保真度警告等错误
答案 0 :(得分:1)
只添加此行android:layout_below="@+id/firstlayout"
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/sw_refresh"
android:layout_width="match_parent"
android:layout_below="@+id/firstlayout"
android:layout_height="fill_parent">
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:listSelector="@drawable/list_selector"
android:background="@drawable/customshape"
android:fadeScrollbars="false" >
</ListView>
</android.support.v4.widget.SwipeRefreshLayout>