Android 布局代码中的错误是什么
这个代码有什么错误,请告诉我这种方法是否正确 当我加载列表项时,列表会一直扩展到搜索栏,而不是整个屏幕。请告诉我Android 布局代码中的错误是什么,android,layout,user-interface,Android,Layout,User Interface,这个代码有什么错误,请告诉我这种方法是否正确 当我加载列表项时,列表会一直扩展到搜索栏,而不是整个屏幕。请告诉我 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent" android:background="#000044">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:background="#000044">
<TableRow>
<EditText
android:id="@+id/txtUserName"
android:width="270dp" />
<Button
android:id="@+id/Search_button"
android:width="50dp" />
/>
</TableRow>
<TableRow>
<ListView
android:id="@+id/Service_name_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
/>
同时告诉我,这是否适用于所有屏幕。更改第二行,如下所示:
<TableRow android:layout_span="2">
<ListView
android:id="@+id/Service_name_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</TableRow>
唯一改变的是android:layout_span=“2”,它等于HTML colspan。添加一个布局以强制一个单元格跨越两个单元格
<ListView
android:id="@+id/Service_name_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_span="2"/>