将导航栏在屏幕的Android应用程序底部 [英] Place navigation bar at the bottom of the screen in Android application
本文介绍了将导航栏在屏幕的Android应用程序底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要放置在屏幕底部的导航栏在我的Android应用程序。我该怎么办呢?样品code将是有益的。
I want to place navigation bar at bottom of the screen in my Android application. How can I do that? Sample code would be helpful.
推荐答案
如果您使用的是RelativeLayout的为您的活动的根,你可以调整其他视图屏幕的底部。这一点,再加上的LinearLayout作为一个容器,将提供一个灵活的面板,将导航栏的:
If you use a RelativeLayout for the root of your activity, you can align other views to the bottom of the screen. This, combined with a LinearLayout as a container, will provide a flexible panel for putting your navigation bar in:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_height="wrap_content"
android:id="@+id/back"
android:text="Back"
android:layout_width="wrap_content" />
<Button
android:layout_height="wrap_content"
android:id="@+id/home"
android:text="Home"
android:layout_width="wrap_content" />
<Button
android:layout_height="wrap_content"
android:id="@+id/next"
android:text="Next"
android:layout_width="wrap_content" />
</LinearLayout>
</RelativeLayout>
这篇关于将导航栏在屏幕的Android应用程序底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文