如何把图标的操作栏中的标签左边 [英] How to put the icon to the left of action bar tabs
本文介绍了如何把图标的操作栏中的标签左边的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我现在用的是ActionBar.Tab,他们总是出现在屏幕的左侧。我想提出的活动图标选项卡的左侧,但它总是出现在标签的右侧。我怎样才能把他们的位置,我想要的吗?
I am using the ActionBar.Tab, and they always appear at the left of screen. I want to put the activity icon to the left of tabs, but it always appear at the right of tabs. How can I move their position to where I want?
推荐答案
这里是我的作品就像一个梦想: 在活动我有这样的:
here is what works for me like a dream: in the Activity I have this:
//hiding default app icon
ActionBar actionBar = getActionBar();
actionBar.setDisplayShowHomeEnabled(false);
//displaying custom ActionBar
View mActionBarView = getLayoutInflater().inflate(R.layout.my_action_bar, null);
actionBar.setCustomView(mActionBarView);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM)
my_action_bar.xml:
my_action_bar.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/turquoise">
<ImageButton
android:id="@+id/btn_slide"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@null"
android:scaleType="centerInside"
android:src="@drawable/btn_slide"
android:paddingRight="50dp"
android:onClick="toggleMenu"
android:paddingTop="4dp"/>
</RelativeLayout>
这篇关于如何把图标的操作栏中的标签左边的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文