簡體   English   中英

我想在我的android布局中執行此操作

[英]I want to do this in my layout of android

我想在主布局上顯示2個不同的面板。底部欄將包含兩個按鈕

  1. 按鈕將向上和向下滑動“設置”面板,然后
  2. 按鈕將打開和關閉接觸面板

我已經搜索了很多,但只找到了Slidedrawer,但是如何通過單擊按鈕來顯示不同的面板?

在此處輸入圖片說明

在此處輸入圖片說明

您可以將“設置”和“接觸式滑動抽屜”分別放置在包含它們的RelativeLayout下,並使它們彼此重疊。 然后,將按鈕用作彼此對齊的手柄。

考慮下面的xml代碼,希望對您有所幫助:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >


    <SlidingDrawer
    android:id="@+id/slidingDrawer1"
    android:layout_width="match_parent"
    android:layout_height="370dp"
    android:layout_marginTop="52dp"
    android:content="@+id/settings_panel"
    android:handle="@+id/handle1" >

    <Button
        android:id="@+id/handle1"
        android:layout_width="wrap_content"
        android:layout_height="45dp"
        android:background="@drawable/handle_tab" 
        android:text="Settings" />

    <LinearLayout
        android:id="@+id/settings_panel"
        android:layout_width="match_parent"
        android:layout_height="485dp"
        android:background="#000000" >



    </LinearLayout>
    </SlidingDrawer>


    <SlidingDrawer
    android:id="@+id/slidingDrawer2"
    android:layout_width="match_parent"
    android:layout_height="370dp"
    android:layout_marginTop="52dp"
    android:content="@+id/contact_panel"
    android:handle="@+id/handle2" >

    <Button
        android:id="@+id/handle2"
        android:layout_width="wrap_content"
        android:layout_height="45dp"
        android:background="@drawable/handle_tab" 
        android:text="Contact" />

    <LinearLayout
        android:id="@+id/contact_panel"
        android:layout_width="match_parent"
        android:layout_height="485dp"
        android:background="#FF0000" >



    </LinearLayout>
    </SlidingDrawer>
    </RelativeLayout>

然后使用鏈接幫助正確定位“聯系人和設置”手柄(按鈕): 更改SlidingDrawer手柄的對齊方式(左,右等)

暫無
暫無

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

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