2016-04-14 21 views
0

tarafından değiştirilmez. 25.1.2TextView'un Renk Ben Android Studio son güncellemenin ve SDK beri böyle bir sorun var mı tarzı

Android Studio: Android Studio 2.0 Yapı # AI-143,2739321, 5 Nisan 2016 JRE üzerine inşa: 1.7.0_80-b15 amd64

I tarzı ile artık TextView rengini değiştiremez. ...

inşa dk sdk geçerli:

minSdkVersion 19 
targetSdkVersion 22 
compileSdkVersion 22 
buildToolsVersion "22.0.1" 

TextView'un "dashboardGridItemTitleTextView" her zaman varsayılan bir renk içermiyor ("beyaz")

ana öğenin Düzen:

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="180dp" 
    android:layout_height="180dp" 
    android:orientation="vertical" 
    android:padding="20dp"> 

    <ImageView 
     android:id="@+id/dashboardGridItemImageView" 
     android:layout_width="100dp" 
     android:layout_height="100dp" 
     android:src="@drawable/textmessage_128" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" /> 

    <TextView 
     android:id="@+id/dashboardGridItemTitleTextView" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_centerHorizontal="true" 
     android:layout_gravity="center_vertical" 
     android:gravity="center_horizontal" 
     android:text="@string/title_load_containers" 
     android:textAppearance="?android:attr/textAppearanceMedium"/> 

    <TextView 
     android:id="@+id/badgeTextView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginRight="15dp" 
     android:layout_marginTop="0dp" 
     android:background="@drawable/rounded_badge" 
     android:minWidth="10dp" 
     android:padding="4dp" 
     android:text="0" 
     android:visibility="gone" 
     android:textIsSelectable="false" /> 

</RelativeLayout> 

Hiçbir şey bildiğim özel ve uygulama için kullanılan stil.

<resources> 

    <style name="CommonAppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> 
     <item name="android:actionBarStyle">@style/CommonActionBar</item> 
     <item name="android:buttonStyle">@style/buttonStyle</item> 
     <item name="android:alertDialogTheme">@style/dialogTheme</item> 
     <item name="android:imageButtonStyle">@style/MarginlessImageButton</item> 
     <item name="android:windowEnableSplitTouch">false</item> 
     <item name="android:splitMotionEvents">false</item> 
     <item name="android:windowDisablePreview">true</item> 
     <item name="android:textViewStyle">@style/textViewStyle</item> 

     <item name="theme_dependent_list_item_background">@drawable/company_list_bg</item> 
     <item name="theme_dependent_list_item_background_highlighted"> 
      @drawable/company_list_bg_highlighted 
     </item> 
     <item name="theme_dependent_default_button">@drawable/button_rounded_corner</item> 
     <item name="theme_dependent_text_color">@color/black</item> 
     <item name="theme_dependent_text_color_highlighted">@color/black</item> 

     <item name="theme_dependent_button_rounded_corner_green"> 
      @drawable/button_rounded_corner_green 
     </item> 
     <item name="theme_dependent_button_rounded_corner_red">@drawable/button_rounded_corner_red 
     </item> 
    </style> 

    <style name="CommonAppThemeDark" parent="android:Theme.Holo"> 
     <item name="android:actionBarStyle">@style/CommonActionBar</item> 
     <item name="android:buttonStyle">@style/buttonStyleDark</item> 
     <item name="android:alertDialogTheme">@style/dialogThemeDark</item> 

     <item name="android:windowDisablePreview">true</item> 
     <item name="android:textViewStyle">@style/textViewStyleDark</item> 
     <item name="theme_dependent_list_item_background">@drawable/company_list_bg_dark</item> 
     <item name="theme_dependent_list_item_background_highlighted"> 
      @drawable/company_list_bg_dark_highlighted 
     </item> 
     <item name="theme_dependent_default_button">@drawable/button_rounded_corner_dark</item> 
     <item name="theme_dependent_text_color">@drawable/company_list_text_dark</item> 
     <item name="theme_dependent_text_color_highlighted">@drawable/company_list_text_dark</item> 

     <item name="theme_dependent_button_rounded_corner_green"> 
      @drawable/button_rounded_corner_green_dark 
     </item> 
     <item name="theme_dependent_button_rounded_corner_red"> 
      @drawable/button_rounded_corner_red_dark 
     </item> 
    </style> 

    <style name="CommonActionBar" parent="@android:style/Widget.Holo.Light.ActionBar"> 
     <item name="android:background">@color/darkGreen</item> 
     <item name="android:displayOptions">showCustom</item> 
     <item name="android:titleTextStyle">@style/titleTextStyle</item> 
     <item name="android:gravity">center</item> 
    </style> 

    <style name="titleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title"> 
     <item name="android:textColor">@color/white</item> 
     <item name="android:layout_gravity">center_horizontal</item> 
     <item name="android:gravity">center_horizontal</item> 
     <item name="android:textSize">@dimen/abc_text_size_large_material</item> 
    </style> 

    <style name="ListViewStyle" parent="@android:style/Widget.ListView"> 
     <item name="android:listSelector">@drawable/company_list_bg</item> 
     <item name="android:listChoiceBackgroundIndicator">@drawable/company_list_bg</item> 
     <item name="android:listChoiceIndicatorSingle">@drawable/company_list_bg</item> 
     <item name="android:listChoiceIndicatorMultiple">@drawable/company_list_bg</item> 
    </style> 

    <style name="buttonStyle" parent="android:style/Widget.Button"> 
     <item name="android:padding">10dp</item> 
     <item name="android:background">@drawable/button_rounded_corner</item> 
    </style> 

    <style name="buttonStyleDark" parent="android:style/Widget.Button"> 
     <item name="android:padding">10dp</item> 
     <item name="android:background">@drawable/button_rounded_corner_dark</item> 
     <item name="android:textColor">@drawable/button_text_dark</item> 
    </style> 

    <style name="MarginlessImageButton" parent="android:Widget.ImageButton"> 
     <item name="android:background">@null</item> 
    </style> 

    <!-- TextView --> 

    <style name="textViewStyle" parent="android:style/Widget.TextView"> 
     <item name="android:textColor">@color/black</item> 
     <item name="android:color">@color/black</item> 
     <item name="android:textAppearance">@style/commonTextAppearance</item> 
    </style> 

    <style name="commonTextAppearance" parent="@android:style/TextAppearance"> 
     <item name="android:textColor">@color/black</item> 
     <item name="android:color">@color/black</item> 
    </style> 

    <style name="textViewStyleDark" parent="android:style/Widget.TextView"> 
     <item name="android:textColor">@color/white</item> 
     <item name="android:color">@color/white</item> 
     <item name="android:textAppearance">@style/commonTextAppearanceDark</item> 
    </style> 

    <style name="commonTextAppearanceDark" parent="@android:style/TextAppearance"> 
     <item name="android:textColor">@color/white</item> 
     <item name="android:color">@color/white</item> 
    </style> 

    <!-- Alert/Dialog Theme|Style --> 

    <style name="dialogTheme" parent="@android:style/Theme.Holo.Light.Dialog"> 
     <item name="android:buttonBarButtonStyle">@style/DialogButtonStyle</item> 
     <item name="android:windowBackground">@android:color/transparent</item> 
     <item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item> 
     <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item> 
     <item name="android:windowIsFloating">true</item> 
     <item name="android:buttonBarStyle">@style/DialogButtonBarStyle</item> 
     <item name="android:buttonStyle">@style/DialogButtonStyle</item> 
    </style> 

    <style name="dialogThemeDark" parent="@android:style/Theme.Holo.Dialog"> 
     <item name="android:buttonBarButtonStyle">@style/DialogButtonStyleDark</item> 
     <item name="android:windowBackground">@android:color/transparent</item> 
     <item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item> 
     <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item> 
     <item name="android:windowIsFloating">true</item> 
     <item name="android:buttonBarStyle">@style/DialogButtonBarStyle</item> 
     <item name="android:buttonStyle">@style/DialogButtonStyleDark</item> 
    </style> 

    <style name="DialogButtonBarStyle"> 
     <item name="android:showDividers"></item> 
    </style> 

    <style name="DialogButtonStyle" parent="android:style/Widget.Button"> 
     <item name="android:padding">10dp</item> 
     <item name="android:layout_marginTop">5dp</item> 
     <item name="android:layout_marginBottom">5dp</item> 
     <item name="android:layout_marginLeft">10dp</item> 
     <item name="android:layout_marginRight">10dp</item> 
     <item name="android:background">@drawable/button_rounded_corner</item> 
    </style> 

    <style name="DialogButtonStyleDark" parent="android:style/Widget.Button"> 
     <item name="android:padding">10dp</item> 
     <item name="android:layout_marginTop">5dp</item> 
     <item name="android:layout_marginBottom">5dp</item> 
     <item name="android:layout_marginLeft">10dp</item> 
     <item name="android:layout_marginRight">10dp</item> 
     <item name="android:background">@drawable/button_rounded_corner_dark</item> 
     <item name="android:textColor">@drawable/button_text_dark</item> 
    </style> 
</resources> 

Ben bu sabit almak için her şeyi denedik .... Ama çalışmaz: Ben tema anahtarı çok karanlık tema umurumda değil var. Bu yeni kişiye yardım eden var mı? Şimdiden teşekkürler!

DÜZENLEME:

Ben yapı günlüğüne buldum:

2016/04/12 10: 19: [7270100] WARN 06933 - rendering.ConfigurationMatcher - 'varsayılan' bir iyi değil Dosya için herhangi bir cihaz/yerel kombinasyonun eşleşmesi: // C: /Sources/iApps/iMulco/app/src/main/res/layout/grid_item_dashboard.xml. ile görüntüleniyor,, Sağdan Sola, sw384dp, w384dp, h640dp, Normal Ekran, Kısa ekran en boy oranı, Yuvarlak Görüntü Yok, Dikey Yön, Normal, Gündüz zamanı, X-Yüksek Yoğunluk, Parmak tabanlı dokunmatik ekran, Yumuşak klavye No klavye, Gizli gezinme, No navigasyon, Ekran çözünürlüğü 1280x768 API Seviye 24

yerine doğrudan renk hex kodunu vererek ya kullanarak XML stil daha iyi kullanılması kullanım textColor özelliğini kullanmanın

+0

Neden stil kullanıyorsunuz? XML basit metin rengi koydu? –

+0

Stil ile yapmanıza gerek yok, bu şeyleri iki şekilde doğrudan yapabilirsiniz, xml dosyalarına metin rengi verin veya textview.setTextColor (getResources(). GetColor (R.color.YOURCOLOR) gibi java dosyanızdaki metin görünümünüze renk ayarlayın)); – Radhey

+0

Okur musun? : Temas anahtarım var bu yüzden karanlık temayı önemsemeyin: –

cevap

1

Belki değerler-v21 klasörünüz var ve orada metin rengi beyaz (veya değiştirilmemiş)

-1

renk kaynağı kimliği

<TextView 
    android:id="@+id/dashboardGridItemTitleTextView" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true" 
    android:layout_gravity="center_vertical" 
    android:gravity="center_horizontal" 
    android:text="@string/title_load_containers" 
    android:textColor="#000000" //whichever color you want 
    android:textAppearance="?android:attr/textAppearanceMedium"/> 
+0

Üzgünüm arkadaşım haklısın bunu yapabilirim ... Ama her TextView Control için rengi ayarlamak istemiyorum! Temayı değiştiriyorum, böylece temayı değiştirdiğimde tekrar her TextView için bunu yapmalıyım? En iyi uygulama sry değil ... Bu sadece bir çözüm değil bir çözüm! –

İlgili konular