繁体   English   中英

Android中的底部栏具有以上不同的布局?

[英]Bottom bar in Android with different layout above?

我想在Android中有一个共同的底线。 如果单击了任何按钮,则它将打开新活动,但底部栏仍在底部。 有什么办法可以做到这一点? 我尝试过在底部具有4个按钮的超类,然后在click事件上打开新活动,但我不知道为什么底部栏不显示,这是否是正确的方法?

我这样做的方法是拥有一个Activity其中包括一个占据大部分窗口的ViewFlipper和一个位于底部的按钮栏。 孩子的“活动”只是ViewFlipper孩子。 很好

后来添加的示例:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:orientation="vertical" 
>
    <ViewFlipper 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_weight="1"
    > 

    <!-- Your pages go here, i.e.: -->
    <include android:id="@+id/page1" layout="@layout/page1" />
    <include android:id="@+id/page2" layout="@layout/page2" />
    ...

    </ViewFlipper>

    <!-- Your bottom bar -->
    <LinearLayout
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:orientation="horizontal" 
    >
    ... buttons or whatever you want here ...
    </LinearLayout>

</LinearLayout>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM