简体   繁体   中英

Button in Android XML Layout

I'm working with a package some fellow members found for me that allows a slider to start at the top and slide to the bottom. I need to add content behind the slider, but I'm unsure of where to put it in the XML. Maybe I have to add a linear layout, but I'm not sure. I just need to add one button that sits in the very center of the screen. I think it needs to be put in the following code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:ns="http://schemas.android.com/apk/res/it.sephiroth.demo.slider">

<Button
    android:id="@+id/button_open"
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    android:text="@string/open"
    android:layout_centerInParent="true"
    android:visibility="gone" />

<it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer
    xmlns:my="http://schemas.android.com/apk/res/it.sephiroth.demo.slider"
    android:id="@+id/drawer"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    ns:content="@+id/content"
    ns:direction="topToBottom"
    ns:handle="@+id/handle" >

    <include
        android:id="@id/content"
        layout="@layout/pen_content" />

    <ImageView
        android:id="@id/handle"
        android:layout_width="wrap_content"
        android:layout_height="40px"
        android:src="@drawable/sliding_drawer_handle_bottom" />
</it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer>
</RelativeLayout>

I'd also like for the button to be behind the drawer. Any help would be great!

Try This:

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:ns="http://schemas.android.com/apk/res/it.sephiroth.demo.slider">
<LinerLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:gravity="center"
android:layout_height="wrap_content" >

<Button
android:id="@+id/button_open"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/open"
android:layout_centerInParent="true"
android:visibility="gone" />
</LinerLayout

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM