Reputation: 2500
I searched a lot but nothing seems to work in my case. Here is what I want to achieve using relative layout.
below is my xml code for it.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:focusable="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/microphone" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/white"
android:padding="@dimen/padding_16">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:drawableRight="@drawable/arrow"
android:text="@string/next"
android:textAllCaps="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/arrow"
android:text="@string/previous"
android:textAllCaps="true" />
</RelativeLayout>
By doing this the microphone is hidden behind the Next-Previous Strip. I guess there is some parameter to control the view height in z-axis but I don't remember that and will it work below Lolipop too. Please help.
Upvotes: 0
Views: 2801
Reputation: 2641
If you want to show your "Microphone Layout", you don't have to do much with your current layout(xml)
Just put your "Microphone Relative Layout" after "Previous and Next Relative Layout", like below
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/white"
android:padding="@dimen/padding_16">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:drawableRight="@drawable/arrow"
android:text="@string/next"
android:textAllCaps="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/arrow"
android:text="@string/previous"
android:textAllCaps="true"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:focusable="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/microphone"/>
</RelativeLayout>
</RelativeLayout>
Hope this helps you.
Upvotes: 4