I am trying to do footer to my custom list but still cant work it out.
My aim is just to add some button to end of the list.
I tried this:
adapter = new GeneralRssAdapter(this,R.layout.titlesrss, data);
LayoutInflater inflater = getLayoutInflater();
lv.addFooterView( inflater.inflate( R.layout.footer_layout, null ), null, false);
lv.setAdapter(adapter);
but still cant see any footer.
Heres my xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/linearLa"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/iconremove"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_margin="5dip"
android:scaleType="centerCrop"
android:src="#drawable/delete"
android:visibility="gone" />
<ImageView
android:id="#+id/iconfav"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_margin="5dip"
android:scaleType="centerCrop"
android:src="#drawable/rss" />
<TextView
android:id="#+id/textView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:layout_margin="5dip"
android:layout_weight="1"
android:textSize="20dip" />
</LinearLayout>
<ListView android:id="#+id/ListView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
and the footer:
<?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" >
<ImageView
android:id="#+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.20"
android:src="#drawable/tutorialrss"
/>
</LinearLayout>
hope you can HELP me:)
try this
adapter = new GeneralRssAdapter(this,R.layout.titlesrss, data);
LayoutInflater mInflater = (LayoutInflater)getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
final View footer = mInflater.inflate(R.layout.footer_layout, null);
choicelist.addFooterView(footer);
choicelist.setAdapter(adapter);
i have edited this 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" >
<ImageView
android:id="#+id/image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/tutorialrss"
/>
</LinearLayout>
for me its working plz check once.
adapter = new ListAdapter(this, data);
ListView lvMain = (ListView) findViewById(R.id.list);
LayoutInflater mInflater = (LayoutInflater) getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
final View footer = mInflater.inflate(R.layout.footer, null);
lvMain.addFooterView(footer);
lvMain.setAdapter(adapter);
What I do is set my footer/header in setContentView() then uselist xml in adapter. I don't normally like one line answers but that's all I do
Related
I have a custom ListView.
I want to add a fixed button on the bottom of the screen.
How should I change my layout?
My screen XML code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".ListAdapter" >
<ImageView
... />
<TextView
... />
</RelativeLayout>
My custom arrayAdapter source code:
#Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.msg_detail_layout, parent, false);
msgBodyCustomer = (TextView) rowView.findViewById(R.id.MsgBodyCustomer);
contactImageCustomer = (ImageView) rowView.findViewById(R.id.PhotoImageCustomer);
if(!smslist.get(position).getType().equals(INBOX)){
msgBodyOwner.setText(smslist.get(position).getBody());
contactImageCustomer .setImageURI((smslist.get(position).getPicture()));
return rowView;
}
}
Edited:try this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".ListAdapter" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="#+id/button5"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/listView7"
android:layout_alignRight="#+id/PhotoImageOwner"
android:layout_above="#+id/button5" />
</RelativeLayout>
Alternatively, you can add footer for your custom listview
The footer will always be at bottom
Code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="7dip"
android:paddingBottom="7dip"
android:orientation="horizontal"
android:gravity="center">
<ImageView
android:id="#+id/footer_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
/>
<TextView
android:text="#string/footer_text_1"
android:id="#+id/footer_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
Refer above in your java file onCreate() where you are initialising your listview:
View footerView = ((LayoutInflater) ActivityContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.footer_layout, null, false);
<your_list_view>.addFooterView(footerView);
Reference credit to : this answer
I am having problems with the CWAC Merge Adapter: https://github.com/commonsguy/cwac-merge
This works fine when i am adding views and adapters one after another but it seems that when i try to add two headers one after another it crashes. Here is what i do:
This is the layout for the first header:
<?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="horizontal"
android:weightSum="7"
android:baselineAligned="false" >
<LinearLayout
android:id="#+id/unsynced_layoutt"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="6"
android:orientation="vertical" >
<View
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="#color/greenish" />
<TextView
android:id="#+id/unsynced_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:gravity="center"
android:text="#string/unsynced_txt" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/lorem_ipsum" />
<View
android:layout_width="match_parent"
android:layout_height="3dp"
android:layout_gravity="bottom"
android:background="#color/greenish" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_weight="1"
android:id="#+id/sync_close_notification"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="#color/grey_bcknd">
<ImageButton
android:id="#+id/menu_btn"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="15dp"
android:background="#null"
android:contentDescription="#string/something"
android:src="#drawable/notification_close_x_green" />
</LinearLayout>
</LinearLayout>
The layout for the second header:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/grey_bcknd"
android:orientation="vertical" >
<View
android:id="#+id/top_line"
android:layout_width="match_parent"
android:layout_height="1dp"
android:alpha="0.25"
android:background="#color/grey_line" />
<TextView
android:id="#+id/receipt_header_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/top_line"
android:layout_marginLeft="10dp"
android:text="#string/active_folders"
android:textColor="#B4AA9E" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:layout_below="#+id/receipt_header_txt"
android:alpha="0.25"
android:background="#color/grey_line" />
</RelativeLayout>
and here is where i try to physically add it:
all_adapter = new MergeAdapter();
final View notification = inflater
.inflate(R.layout.unsynced_layout, null);
TextView notification_txt = (TextView) notification.findViewById(R.id.unsynced_txt);
notification_txt.setText("You have "+unsynced_nr+" unsynced items");
all_adapter.addView(notification_txt);
for(int i=0;i<dates.size();i++){
System.out.println("HERE "+i);
View header1 = inflater
.inflate(R.layout.receipt_list_header, null);
TextView date_header_txt = (TextView) header1.findViewById(R.id.receipt_header_txt);
date_header_txt.setText(dates.get(i));
all_adapter.addView(header1);
ReceiptDataSource recs1 = new ReceiptDataSource(globalView.getContext());
recs1.open();
ArrayList<Receipt> currentReceipts = recs.findReceiptsByDate(dates.get(i), folder_id);
recs1.close();
//ReceiptAdapter folder_receipts = new ReceiptAdapter(getActivity(), R.layout.receipt_item, R.layout.receipt_incomplete_item, currentReceipts);
ReceiptCustomAdapter folder_receipts = new ReceiptCustomAdapter(globalView.getContext(), R.layout.receipt_pager,
currentReceipts, getActivity().getSupportFragmentManager());
all_adapter.addAdapter(folder_receipts);
}
and the stacktrace:
08-06 11:54:15.558: E/AndroidRuntime(20408): FATAL EXCEPTION: main
08-06 11:54:15.558: E/AndroidRuntime(20408): java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
08-06 11:54:15.558: E/AndroidRuntime(20408): at android.widget.ListView.measureScrapChild(ListView.java:1170)
08-06 11:54:15.558: E/AndroidRuntime(20408): at android.widget.ListView.measureHeightOfChildren(ListView.java:1252)
If i comment the line:
all_adapter.addView(notification_txt);
the code is not crashing anymore.
Any suggestions highly appreciated, thanks.
You're getting this issue because the MergeAdapter expects AbsListView.LayoutParams. Try this:
final View notification = inflater.inflate(R.layout.unsynced_layout, null);
TextView notification_txt = (TextView) notification.findViewById(R.id.unsynced_txt);
notification_txt.setText("You have "+unsynced_nr+" unsynced items");
AbsListView.LayoutParams layoutParams = new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
notification_txt.setLayoutParams(layoutParams);
all_adapter.addView(notification_txt);
But, in case you are trying to simply add the whole view to your mergeadapter, then instead of all_adapter.addView(notification_txt); you could say: all_adapter.addView(notification);
I'm developing an application with ListView for Student Marklist creation.
In this application, the List have 10 students. There are four grades provided for the exam which was conducted to those Students. One student can adapt only one grade from the four.
The teacher will assign the grade to the student in ListView.
My xml file Studentlist.xml is as follow:
<?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" >
<ListView
android:id="#+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
and my row.xml file is as follow:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="500dp"
android:layout_height="fill_parent"
android:padding="10dp" >
<TableRow>
<TextView
android:id="#+id/SNo"
style="#style/text"
android:layout_width="40dp"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/StudNo"
style="#style/text"
android:layout_width="80dp"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/StudName"
style="#style/text"
android:layout_width="180dp"
android:layout_height="wrap_content" />
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/radio0"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:checked="true" />
<RadioButton
android:id="#+id/radio1"
android:layout_width="40dp"
android:layout_height="wrap_content" />
<RadioButton
android:id="#+id/radio2"
android:layout_width="40dp"
android:layout_height="wrap_content" />
<RadioButton
android:id="#+id/radio3"
android:layout_width="40dp"
android:layout_height="wrap_content" />
</RadioGroup>
</TableRow>
Now I'm trying for the output in the form of:
1 0001 AAAA <RadioButton1> <RadioButton2> <RadioButton3> <RadioButton4>
2 0002 BBBB <RadioButton1> <RadioButton2> <RadioButton3> <RadioButton4>
How can I use the Adapter functionalities?
ArrayAdapter<String,String,String,RadiGroup> studList=new ArrayAdapter<String,String,String,RadiGroup>();
Can I use like this, and how to develop the customized Adapter for the ListView?
Suggest me for the best solution!
This is a sample example of custom adapter for listview. Modify it as your need:
XML layout :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="#+id/main"
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Header -->
<LinearLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/black" >
<TextView
android:id="#+id/item2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:height="30dip"
android:text="Latest News - Your Healing Place"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FFFFFF"
android:width="100dip" />
<TextView
android:id="#+id/item1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:height="30dip"
android:width="20dip" />
</LinearLayout>
<View android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="?android:attr/listDivider" />
<LinearLayout android:id="#+id/layout"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<ListView
android:id="#+id/listview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/black" >
</ListView>
</LinearLayout>
</LinearLayout>
news.java :
List<HashMap<String, String>> fillMaps = new ArrayList<HashMap<String, String>>();
String[] from = new String[] {"details", "date"};
int[] to = new int[] { R.id.item1, R.id.item2};
ListView lv= (ListView)findViewById(R.id.listview);
HashMap<String, String> map = new HashMap<String, String>();
map.put("details", "This is a sample message");
map.put("date", "24-07-2003");
fillMaps.add(map);
SimpleAdapter adapter = new SimpleAdapter(this, fillMaps, R.layout.grid_item, from, to);
lv.setAdapter(adapter);
You can use a class inheriting from ArrayAdapter, and overriding its getView() method.
public class StudentAdapter extends ArrayAdapter<Student> {
protected LayoutInflater inflater;
public StudentAdapter(final Context context) {
super(context, 0);
inflater = (LayoutInflater) ((Context) context)
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public View getView(int position, View convertView, ViewGroup parent) {
// Note: You should optimize here with re-using convertView
View rowView = inflater.inflate(R.layout.user_address_row_layout,
parent, false);
TextView sNo = (TextView) rowView.findViewById(R.id.sNo);
sNo.setText(getItem(position).number);
// same for every field of the row
// ...
return rowView;
}
}
The gridview of my application has an image and a text below it for each grid.
I need to make sure that the complete list of grid fit in to the screen (no overflow at bottom).
Here is how i have defined my gridview
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/gridview" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numColumns="3"
android:stretchMode="columnWidth"
android:layout_below="#+id/text1view"
android:gravity="center"
android:background="#drawable/home_bg"
/>
and each grid item is :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/GridItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal"
>
<ImageView android:id="#+id/grid_item_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="0dip"
android:layout_margin="0dip"
>
</ImageView>
<TextView android:id="#+id/grid_item_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:padding="0dip"
android:gravity="center_horizontal"
android:layout_below="#+id/grid_item_image"
android:layout_alignParentBottom="true"
>
</TextView>
</LinearLayout>
I have tried several ways to set the grid view layout param, but i am not getting the right output. Please help me here. the gridview adapter code is
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
LayoutInflater mInflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.griditems, null);
holder = new ViewHolder();
holder.text1 = (TextView) convertView
.findViewById(R.id.grid_item_text);
Log.i(TAG, holder.text1.toString());
holder.image = (ImageView) convertView
.findViewById(R.id.grid_item_image);
// if it's not recycled, initialize some attributes
holder.image.setImageResource(gridItemIds[position]);
holder.text1.setText(gridTitles[position]);
int h = mContext.getResources().getDisplayMetrics().densityDpi;
convertView.setLayoutParams(new GridView.LayoutParams(h-50, h-20));
//holder.image.setScaleType(ImageView.ScaleType.CENTER_CROP);
//holder.image.setScaleType(ImageView.ScaleType.FIT_XY); ......
Try this:-
grid_item.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:id="#+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center">
<ImageView android:id="#+id/imgIcon" android:src="#drawable/icon" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
<TextView android:text="TextView" android:id="#+id/txtDesc" android:layout_height="wrap_content" android:layout_width="wrap_content"></TextView>
</LinearLayout>
</LinearLayout>
gridview.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="#+id/mobGrid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:numColumns="auto_fit"
android:columnWidth="60dp"
android:stretchMode="columnWidth"
android:gravity="center"
/>
</LinearLayout>
try
android:layout_width="fill_parent"
android:layout_height="fill_parent"
for your GridView instead of wrap_content!
I use the following main.xml for my app.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/toplinear">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linear">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Previous"
android:id="#+id/previous"
android:layout_weight="1"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Next"
android:id="#+id/next"
android:layout_toRightOf="#id/previous"
android:layout_weight="1"
/>
</LinearLayout>
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/android:list"
android:layout_weight="10"
/>
</LinearLayout>
I want to have 2 buttons at the top, previous and next and my listview with custom adapter below it. Few days ago I had only my ListView showing, going over the buttons. Now I seem to be stuck on the other side, where my listview doesn't show while my buttons do.
My activity extends on ListActivity and uses this code to fill it with a customadapter.
ListView lv = getListView();
lv.setAdapter(new MyCustomAdapter(this, R.layout.custom_list, nameResults));
public class MyCustomAdapter extends ArrayAdapter<String> {
private String[] nameResults;
private Context context;
public MyCustomAdapter(Context context, int textViewResourceId,
String[] names) {
super(context, textViewResourceId, names);
this.context = context;
nameResults = names;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
if (row == null) {
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.custom_list, parent, false);
}
TextView label = (TextView) row.findViewById(R.id.Name);
label.setText(nameResults[position]);
TextView descr = (TextView) row.findViewById(R.id.Description);
descr.setText(linkedResults.get(nameResults[position]));
return row;
}
}
I tried using "lv.addHeaderView(previous);" but that only gave me vague ClassCastExceptions about LayoutParams.
I think my problem is currently in my main.xml, as the Layout tab in Eclipse of it won't show the ListView either. It knows its there as it shows up in the outline tab, but the visual representation doesn't give it a red outline when I select it.
For completeness, my custom_list (aka row) layout xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/Name"
android:textColor="#000000"
android:textStyle="bold"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/Description"
android:textColor="#000000"
/>
</LinearLayout>
I'm modified your main.xml a bit - added orientation and took off the layout_weight for the listview - hopefully this fixes that problem.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="#+id/toplinear">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/linear">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Previous"
android:id="#+id/previous"
android:layout_weight="1"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Next"
android:id="#+id/next"
android:layout_toRightOf="#id/previous"
android:layout_weight="1"
/>
</LinearLayout>
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/android:list"
/>
</LinearLayout>