我在下面添加了我的代码。同步按钮后不显示列表视图项目。我正在使用相对布局
<Button
android:id="@+id/button_sync"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_sync" />
<ListView
android:id="@+id/company_factory_truck_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/button_sync"
android:divider="@android:color/transparent"
android:dividerHeight="10.0sp"
>
</ListView>
答案 0 :(得分:0)
此代码同时显示按钮和列表视图
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button_sync"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_sync" />
<ListView
android:id="@+id/company_factory_truck_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/button_sync"
android:divider="@android:color/transparent"
android:dividerHeight="10.0sp"
>
</ListView>
</RelativeLayout>
[This pic shows the output][1]
[1]: https://i.stack.imgur.com/7yaTb.png