如何添加滑动菜单上activtity这在Android的延伸tabactivity这在、菜单、tabactivity、activtity

2023-09-08 08:44:03 作者:梨花未盛开

如何滑动菜单添加到其延伸标签活动未在滑动菜单和活动添加的活性

How to add sliding menu to the activity which are not added in the sliding menu and on activity which extends tab Activity

任何帮助将AP preciated。在此先感谢

Any help will be appreciated. Thanks in advance

推荐答案

主要XML改变你这样的事情。(之前做到这一点,你的项目 - 右键点击> Android的工具 - >添加支持库,做好这项工作两次 - )

change you main xml to something like this.(before do this,right click on your project->android tools->add support library-do this work twice-)

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000" >

    <!-- you main xml,all of your xml -->
</RelativeLayout>

<ScrollView
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start" >

    <RelativeLayout
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        tools:context=".Tab_login" >

        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/button3"
            android:layout_alignRight="@+id/button3"
            android:layout_below="@+id/button3"
            android:layout_marginTop="21dp"
            android:text="Register" />

        <Button
            android:id="@+id/button3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:text="Log In" />

        <Button
            android:id="@+id/Button02"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/button2"
            android:layout_alignRight="@+id/button2"
            android:layout_below="@+id/button2"
            android:layout_marginTop="19dp"
            android:text="free User" />

        <Button
            android:id="@+id/Button01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/Button02"
            android:layout_alignRight="@+id/Button02"
            android:layout_below="@+id/Button02"
            android:layout_marginTop="23dp"
            android:text="Roaming" />
    </RelativeLayout>
</ScrollView>

</android.support.v4.widget.DrawerLayout>  

结果PIC:结果

THE RESULT PIC: