[英]Android action bar multiple items both up and bottom sides
I would like to have a custom action bar which should contain tabs and action buttons, as in attached picture: 我希望有一个自定义操作栏,其中应包含选项卡和操作按钮,如所附图片所示:
As in the picture, I would like to have the app logo and title, followed by some action buttons, then the tabs and then in the bottom bar some more action buttons. 如图所示,我想拥有应用程序徽标和标题,然后是一些操作按钮,然后是选项卡,然后在底部栏中有更多操作按钮。 I googled for a solution but so far I have just found some solutions based on 3rd party libraries (which I do not want) or implementing a separated header or footer.
我用谷歌搜索了一个解决方案,但到目前为止,我刚刚发现了一些基于第三方库(我不想要)或实现单独的页眉或页脚的解决方案。 Maybe there is a better and quicker solution to achieve something as in the picture.
也许有更好,更快的解决方案来实现如图所示的功能。 I tried to use the
我尝试使用
android:uiOptions="splitActionBarWhenNarrow"
but it doesn't behave as I would like to, meaning that both in portrait and landscape mode, and no matter the device, I would like to have the action buttons always on the same position, similar as in the picture. 但它的行为不符合我的意愿,这意味着无论是在纵向还是横向模式下,无论使用哪种设备,我都希望动作按钮始终位于相同的位置,类似于图片中的位置。 Any suggestions are welcome.
欢迎任何建议。 Thanks in advance.
提前致谢。
Try something like this: 尝试这样的事情:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#0000ff"
android:id="@+id/headerRelativeLayout">>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@drawable/arrow_right"
android:layout_alignTop="@+id/cancelTextView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="@+id/cancelTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ScreenTitle"
android:textColor="#ffffff"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/imageView"
android:layout_toEndOf="@+id/imageView" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView2"
android:src="@drawable/arrow_right"
android:layout_toLeftOf="@id/imageView3" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView3"
android:src="@drawable/arrow_right"
android:layout_alignTop="@+id/cancelTextView"
android:layout_toLeftOf="@id/imageView4"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView4"
android:src="@drawable/arrow_right"
android:layout_alignTop="@+id/cancelTextView"
android:layout_alignParentRight="true"/>
</RelativeLayout>
<TabHost
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/tabHost"
android:layout_below="@+id/headerRelativeLayout"
android:layout_centerHorizontal="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:background="#0000ff"
android:layout_height="wrap_content"></TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/tab1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"></LinearLayout>
<LinearLayout
android:id="@+id/tab2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"></LinearLayout>
<LinearLayout
android:id="@+id/tab3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"></LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#0000ff"
android:id="@+id/headerRelativeLayout2"
android:layout_alignParentBottom="true">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView5"
android:src="@drawable/arrow_right"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView6"
android:src="@drawable/arrow_right" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView7"
android:src="@drawable/arrow_right"/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.