![](/img/trans.png)
[英]How to implement scrollview in android layout XML ?? I want to implement scroll view for my task switcher within button 7 !How do i do it
[英]I want to do this in my layout of android
我想在主布局上顯示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.