首先,是我目前的标签栏的图像
Firstly, there is the image of my current tab bar
欲要么是对准的图像非常向左,同时保持文本居中或移动图像上居中的文字的顶端什么
What I want is either aligning the images to very left, while keeping the text centered or moving the images on top of the text centered.
下面是我如何添加文本:
Here is how I add the texts:
var tab = this.ActionBar.NewTab ();
tab.SetText (tabText);
tab.SetIcon (iconResourceId);
下面是我的相关style.xml条目:
Here is my relevant style.xml entries:
<style name="Theme.Discover" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:actionBarTabStyle">@style/MyActionBarTabStyle</item>
<item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
<item name="android:actionMenuTextColor">#ffffff</item>
<item name="android:windowBackground">@drawable/bg</item>
</style>
<style name="MyActionBarTabStyle" parent="@android:style/Widget.Holo.Light.ActionBar.TabView">
<item name="android:background">@drawable/action_tab_selector</item>
</style>
<!-- ActionBar tabs text styles -->
<style name="MyActionBarTabText"
parent="@android:style/Widget.Holo.ActionBar.TabText">
<item name="android:textColor">#ffffff</item>
</style>
我可以了解java code太多,所以如果你不熟悉Xamarin,我还是AP preciate Java示例和放大器;答案
I can understand java code too so if you are not familiar with Xamarin, I still appreciate the java examples&answers.
我的解决方案是不完美的,但移动这里是正文上方的图标是我到目前为止,这也许能帮助你。
My solution isn't perfect, but to move the icons above the text here is what I have so far, which might be able to help you.
TabLayout.axml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/tab_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent" />
<TextView
android:id="@+id/tab_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
MainActivity.cs
var tab = this.ActionBar.NewTab ();
tab.SetCustomView(Resource.Layout.TabLayout);
tab.CustomView.FindViewById<ImageView>(Resource.Id.tab_icon).SetImageResource(iconResourceId);
tab.CustomView.FindViewById<TextView>(Resource.Id.tab_title).Text = tabText;
上一篇:陷入错误&QUOT; NullPointerException异常&QUOT;即使有数据数组列表数组、异常、错误、数据
下一篇:相机在Android中,如何获得最佳尺寸,preVIEW大小,图片大小,浏览尺寸,图像失真尺寸、图片大小、如何获得、图像