屏幕底部的菜单栏/工具栏在安卓系统中。

4

这里插入图片描述

有人知道怎么做吗?

2个回答

5

使用alignParentBottom="true"的LinearLayout。

像这样:

<RelativeLayout
android:id="@+id/mainLyt"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Some layout things -->

<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/bottomBar">

<!-- some scrolling content -->
</ScrollView>

<LinearLayout
android:id="@+id/bottomBar"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_alignParentBottom="true">

<!-- Some Buttons -->
</LinearLayout>

</RelativeLayout>

我没有尝试编译,您可能需要修复一些打字错误,但是这是一个基本的想法,可以帮助您实现您想要做的事情。


谢谢回复。如果我添加一个ScrollView会怎样?工具栏不会固定在底部。 - Lester1992
它被固定在底部是因为layout_alignParentBottom="true"参数。我将编辑我的示例代码以包括一个滚动视图,请稍等。 - FoamyGuy

-2

在 onCreat 后使用以下代码行。

    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.home_screen);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接