I am quite new to ListViews, that's to begin with.
Anyways, what I want to do, is obviousy to hold a button or whatever on top of my list, which is created programmatically and with only one xml file. The xml file:
<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>
Then in Main.java I simply define my ListAdapter
SimpleAdapter adapter = new SimpleAdapter(Main.this, fillMaps,
R.layout.main, from, to);
setListAdapter(adapter);
So basically I do not have a <ListView/>
in my XML file.
<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>
update
did you want something like this?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.