I want to create a layout in which two bars , one at top , another at bottom will be there, and one listview between these two bars, But question here is , between the top and bottom bar, i need to show list of items, where both top and bottom bar will be there in their place, only listview will be scrollable.
below is my xml layout , sorry for the lengthy question, Any suggestion will be appreciated. Thanks
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
style="@android:style/ButtonBar"
>
<ImageButton
android:id="@+id/IBADDNEW"
android:layout_width="62dp"
android:layout_height="62dp"
android:src="@drawable/ad_user_l" />
<EditText
android:id="@+id/ETSEARCHTEXT"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<requestFocus />
</EditText>
<ImageButton
android:id="@+id/IBSEARCH"
android:layout_width="62dp"
android:layout_height="62dp"
android:src="@drawable/search_64" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true"
>
<LinearLayout
android:id="@+id/LLforList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity ="center_vertical"
android:orientation="horizontal" >
<ImageView
android:id="@+id/IVimageIcon"
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/ic_farmer" />
<TextView
android:id="@+id/TVFLNAME"
android:layout_width="match_parent"
android:layout_height="80dp"
android:text="Some Name"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/blankbarbottom"
android:layout_alignParentBottom="true" >
<LinearLayout
android:id="@+id/FLlayoutLIst"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="horizontal" >
<ImageView
android:id="@+id/btnMainMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:src="@drawable/mainmenu_on" />
<ImageView
android:id="@+id/btnSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:src="@drawable/settings_off" />
<ImageButton
android:id="@+id/btnExit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:src="@drawable/exit_off" />
</LinearLayout>
</RelativeLayout>
Use a ListView for your List. It’s scrollable so you don’t need a ScrollView. Refer to http://developer.android.com/resources/tutorials/views/hello-listview.html on how to use a simple ListView with an Adapter.
And you should also use a TabHost for your Tabs. Have a look at http://developer.android.com/resources/tutorials/views/hello-tabwidget.html