I am trying to build a ListView Activity with a toolbar at the top. The rightmost tool in this toolbar will be a handler to a horizontal SlidingDrawer which will provide a sliding EditText on top of the other tools. First I tried to achieve this with LinearLayout and FrameLayout but the slider went as much as the space that was available minus the tools total width. Right now I have done what I want and works great with the following layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout android:id="@+id/laytoptoolbarhost"
android:layout_width="fill_parent"
android:layout_height="55dip"
android:background="@drawable/toptoolbar_gradient"
android:padding="5dip">
<View android:id="@+id/tool10"
android:layout_width="32dip"
android:layout_height="32dip"
android:paddingRight="3dip"
android:background="#00FF00"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true">
</View>
<View android:id="@+id/tool20"
android:layout_width="32dip"
android:layout_height="32dip"
android:paddingRight="3dip"
android:background="#00FF00"
android:layout_toRightOf="@+id/tool10"
android:layout_centerVertical="true">
</View>
<View android:id="@+id/tool30"
android:layout_width="32dip"
android:layout_height="32dip"
android:paddingRight="3dip"
android:background="#00FF00"
android:layout_toRightOf="@+id/tool20"
android:layout_centerVertical="true">
</View>
<SlidingDrawer android:id="@+id/slidesearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:handle="@+id/sliderhandle"
android:content="@+id/txtsearch">
<ImageView android:id="@+id/sliderhandle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_collapse_states">
</ImageView>
<EditText android:id="@+id/txtsearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp">
</EditText>
</SlidingDrawer>
</RelativeLayout>
<ListView android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawSelectorOnTop="false"/>
<TextView android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="20sp"
android:text="@string/lbl_norecords"/>
The problem is that I have to put a fixed value in RelativeLayout android:layout_height parameter in order for this to work. If I place "wrap_content" then the RelativeLayout fills the entire screen and nothing else is showing.
Any help on this is highly appreciated
Thank you in advance