簡體   English   中英

Android XML布局中的按鈕

[英]Button in Android XML Layout

我正在與一些為我找到的同伴一起使用的軟件包,該軟件包允許滑塊從頂部開始到底部滑動。 我需要在滑塊后面添加內容,但是不確定在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>

我也希望按鈕在抽屜后面。 任何幫助將是巨大的!

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM