1

在Xamarin中,我有一个EditText对象和一个ListView,当文本被输入到EditText对象中时,这些ListView被项目填充。ListView List位置在EditText上

当前,当我在EditText中键入文本时,显示ListView,但是在EditText的顶部,这样我就不能再输入任何数据。

如何在EditText对象下显示ListView?

这里是我的布局代码:提前

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="horizontal" 
    android:padding="5dip"> 
    <FrameLayout 
     android:id="@+id/mapWithOverlay" 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" 
     android:background="#ffffff" 
     android:layout_below="@+id/thumbnail" /> 
    <ListView 
     android:id="@+id/List" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" /> 
    <EditText 
     android:id="@+id/inputSearch" 
     android:layout_width="281.5dp" 
     android:layout_height="45dp" 
     android:hint="Find..." 
     android:layout_marginBottom="15.2dp" 
     android:layout_marginTop="8.5dp" 
     android:layout_marginLeft="8.5dp" /> 
</RelativeLayout> 

感谢

+0

您如何设置相对布局的方向?首先告诉我。 –

+0

相对布局不需要方向。 – Piyush

+0

什么是android:layout_below =“@ + id/thumbnail”? –

回答

0

尝试这个 -

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="horizontal" 
    android:padding="5dip"> 
    <FrameLayout 
     android:id="@+id/mapWithOverlay" 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" 
     android:background="#ffffff" 
     android:layout_below="@+id/thumbnail" /> 
    <ListView 
     android:id="@+id/List" 
     android:layout_width="fill_parent" 
     android:layout_marginTop="50dp" 
     android:layout_height="fill_parent" /> 
    <EditText 
     android:id="@+id/inputSearch" 
     android:layout_width="281.5dp" 
     android:layout_height="45dp" 
     android:hint="Find..." 
     android:layout_marginBottom="15.2dp" 
     android:layout_marginTop="8.5dp" 
     android:layout_marginLeft="8.5dp" /> 
</RelativeLayout> 
0
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="horizontal" 
android:padding="5dip"> 
<FrameLayout 
    android:id="@+id/mapWithOverlay" 
    android:layout_width="fill_parent" 
    android:layout_height="match_parent" 
    android:background="#ffffff" 
    android:layout_below="@+id/thumbnail" /> 
<ListView 
    android:id="@+id/List" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" android:layout_below="@+id/tr" /> 
<TableRow android:layout_width="fill_parent" 
    android:layout_height="wrap_content" android:id="@+id/tr"> 
<EditText 
    android:id="@+id/inputSearch" 
    android:layout_width="281.5dp" 
    android:layout_height="45dp" 
    android:hint="Find..." 
    android:layout_marginBottom="15.2dp" 
    android:layout_marginTop="8.5dp" 
    android:layout_marginLeft="8.5dp" /> 
</TableRow> 
</RelativeLayout> 

试试这个,希望它会帮助你..

+0

为什么需要TableRow? – Piyush

0
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 

    android:padding="5dip"> 


    <EditText 
     android:id="@+id/inputSearch" 
     android:layout_width="281.5dp" 
     android:layout_height="45dp" 
     android:layout_marginBottom="15.2dp" 
     android:layout_marginLeft="8.5dp" 
     android:layout_marginTop="8.5dp" 
     android:hint="Find..." /> 

    <ListView 
     android:id="@+id/List" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_below="@+id/inputSearch" /> 


</RelativeLayout>