简体   繁体   English

三星设备上的TabWidget背景颜色

[英]TabWidget background color on Samsung devices

My TabWidget's background color is light grey on HTC and Nexus devices...however it's blue-ish/dark grey on Samsung devices. 在HTC和Nexus设备上,我的TabWidget的背景颜色是浅灰色...但是在三星设备上,它是蓝/深灰色。 Why is that? 这是为什么? I'm even using a custom theme for the tabwidget, as created by android-holo-colors.com 我什至在为tabwidget使用自定义主题,该主题由android-holo-colors.com创建

Here's the style and the layout for the tab: 这是标签的样式和布局:

<style name="AppBaseTheme" parent="android:Theme.Light">
</style>

<style name="TabMyTheme">
  <item name="android:gravity">center_horizontal</item>
  <item name="android:paddingLeft">16dip</item>
  <item name="android:paddingRight">16dip</item>
  <item name="android:background">@drawable/mytheme_tab_indicator_holo</item>
  <item name="android:layout_width">0dip</item>
  <item name="android:layout_weight">1</item>
  <item name="android:minWidth">80dip</item>
</style>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="@dimen/tab_host_default_height"
    android:orientation="horizontal"
    style="@style/TabMyTheme"
    android:gravity="center">

    <ImageView
        android:id="@android:id/icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical|center_horizontal"
        android:visibility="gone"
        android:adjustViewBounds="true"
        android:scaleType="fitCenter"
        android:contentDescription="@null" />

    <TextView
        android:id="@android:id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        style="@style/TabTextMyTheme" />
</LinearLayout>

I believe the problem is the fact that the default look of tabs is different for Samsung, and given that the background images generated by android-color-colors are transparent on top, and have the color just for the bottom part (ie: the thin or thick colored line at the bottom of each tab), on the top they just use the system default color. 我认为问题是这样的事实,即标签的默认外观对于三星来说是不同的,并且考虑到由android-color-colors生成的背景图像在顶部是透明的,并且仅在底部具有颜色(即:或每个标签底部的粗线),在顶部它们仅使用系统默认颜色。

I changed each and every image generated by the website, replacing the transparent color with my grey, and now it looks fine everywhere. 我更改了网站生成的每个图像,用灰色代替了透明色,现在到处看起来都很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM