Java Android修复了ListActivity上的标题
首先,我对ListView很陌生 无论如何,我想做的是,在我的列表顶部按住一个按钮或任何东西,它是通过编程方式创建的,并且只有一个xml文件。xml文件:Java Android修复了ListActivity上的标题,java,android,xml,listview,Java,Android,Xml,Listview,首先,我对ListView很陌生 无论如何,我想做的是,在我的列表顶部按住一个按钮或任何东西,它是通过编程方式创建的,并且只有一个xml文件。xml文件: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/LinearLayout1" andro
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".Main" >
<ImageView
android:id="@+id/picID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" />
<LinearLayout
android:id="@+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/eventName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp" />
<TextView
android:id="@+id/eventTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="5dp"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
因此,基本上我的XML文件中没有
。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F2B1DBF3"
android:orientation="vertical" >
<Button
android:layout_alignParentTop="true"
android:id="@+id/button"
..
>
<LinearLayout
..
android:layout_below="@+id/button"
>...
</RelativeLayout>
...
更新
你想要这样的东西吗
我不清楚你想要什么。活动顶部固定的按钮还是自定义列表视图?@RohanKandwal我很抱歉不清楚。我想在顶部固定一个按钮。也就是说,如果我滚动生成的列表,按钮将保持在顶部。你需要在listview中放大该布局。使用
相对布局
,按钮为android:layout\u alignParentTop=“true”
@RohanKandwal,它只会给我大量覆盖列表的按钮。不起作用,我拥有的每一项都会有一个按钮,是的,我想要的是图片中的内容。请看这里的链接,它有完整的教程。谢谢,去检查一下out@user2367219你确定如果这个答案对你有帮助,那么你可以点击复选标记将答案标记为已解决。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F2B1DBF3"
android:orientation="vertical" >
<Button
android:layout_alignParentTop="true"
android:id="@+id/button"
..
>
<LinearLayout
..
android:layout_below="@+id/button"
>...
</RelativeLayout>