2012-02-17 124 views
0

我正在使用一些包含一些成員的成員,它允許滑塊從頂部開始並滑動到底部。我需要在滑塊後面添加內容,但我不確定將它放在XML中的位置。也許我必須添加線性佈局,但我不確定。我只需要添加一個位於屏幕中心的按鈕。我認爲它需要把下面的代碼:Android XML佈局中的按鈕

<?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> 

我也爲按鈕是抽屜後面等。 任何幫助將是偉大的!

回答

0
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