我正在使用线性布局,其中包含一个按钮和一个列表视图。列表视图在运行时动态添加其项。因此,在此时,按钮会在列表视图后面,不可见,并且列表视图适配整个布局。
我想把按钮放在列表视图上方,并且加载列表视图后它也必须保持在上面。
谢谢您提前的帮助。
我的.xml文件是:
我的.xml文件是:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#000000">
<Button
android:id="@+id/btn_searchNewDevices"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:layout_gravity="left"
android:background="#000000"
android:textColor="#FFFFFF"
android:text="Search New Devices"
/>
<ListView
android:id="@+id/lst_add_newDevices"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="horizontal" >
</ListView>
</LinearLayout>
这里是搜索新设备的按钮。
点击该按钮,设备将搜索蓝牙并添加到列表视图中。
这就是我的应用程序中发生的事情。