I've more than one elemen in one xml.. listview,slidingdrawer,edittext and button... i want to sliding drawer order is always in front of another elements...but i can't..
here my xml
<com.ltvie.chat.MultiDirectionSlidingDrawer
xmlns:my="http://schemas.android.com/apk/res/com.ltvie.chat"
android:id="@+id/drawer"
my:direction="topToBottom"
android:layout_width="fill_parent"
android:layout_height="match_parent"
my:handle="@+id/handle"
my:content="@+id/content"
>
<include
android:id="@id/content"
layout="@layout/pen_content"
android:gravity="top"
/>
<ImageView
android:id="@id/handle"
android:layout_width="wrap_content"
android:layout_height="5dp"
android:src="@drawable/sliding_drawer_handle_bottom" />
</com.ltvie.chat.MultiDirectionSlidingDrawer>
<ListView android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stackFromBottom="true"
android:transcriptMode="alwaysScroll"
android:layout_above="@+id/InnerRelativeLayout"
android:layout_alignParentTop="true"
/>
<RelativeLayout
android:id="@+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:text="kirim"
android:id="@+id/button_send"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="tambahItems"
>
</Button>
</RelativeLayout>
the result of mycode in my pict bellow :D
i want to know how to fix it??
regard,
Z-Index for Annotation Stacking Order on Android The annotation z-index defines the stacking order of annotations on a page.
FrameLayout is designed to block out an area on the screen to display a single item. Generally, FrameLayout should be used to hold a single child view, because it can be difficult to organize child views in a way that's scalable to different screen sizes without the children overlapping each other.
In Android starting from API level 21, items in the layout file get their Z order both from how they are ordered within the file, as described in correct answer, and from their elevation, a higher elevation value means the item gets a higher Z order.
Your xml does not contain your outer layout, but I assume it is a relative layout. In a RelativeLayout
, the elements' z levels are determine by the order they are added to the container. View added later will be on top. Try moving your sliding drawer to the bottom of your outer container. Like this --
<ListView android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stackFromBottom="true"
android:transcriptMode="alwaysScroll"
android:layout_above="@+id/InnerRelativeLayout"
android:layout_alignParentTop="true"
/>
<RelativeLayout
android:id="@+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:text="kirim"
android:id="@+id/button_send"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="tambahItems"
>
</Button>
</RelativeLayout>
<com.ltvie.chat.MultiDirectionSlidingDrawer
xmlns:my="http://schemas.android.com/apk/res/com.ltvie.chat"
android:id="@+id/drawer"
my:direction="topToBottom"
android:layout_width="fill_parent"
android:layout_height="match_parent"
my:handle="@+id/handle"
my:content="@+id/content"
>
<include
android:id="@id/content"
layout="@layout/pen_content"
android:gravity="top"
/>
<ImageView
android:id="@id/handle"
android:layout_width="wrap_content"
android:layout_height="5dp"
android:src="@drawable/sliding_drawer_handle_bottom" />
</com.ltvie.chat.MultiDirectionSlidingDrawer>
you can just add translation for Z as you want(1dp,2pd,...) like:
<ImageView
android:id="@+id/imageView0"
android:layout_width="110dp"
android:layout_height="110dp"
android:layout_marginTop="25dp"
android:contentDescription="@string/desc"
android:translationZ="1dp"
app:srcCompat="@drawable/ic_icon" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With