2016-10-03 3 views
0

私はAPIレベル24を設定すると、TextViewButtonのテキストの色がxmlから変化しないという基本的な問題に直面しています。アプリがデバイスにインストールされていないときは、まだ解決策が見つかりませんでしたが、なぜそれが起こっているのかわからない、ここで私のXMLファイルです。Apiレベルが24のときにテキストの色がxmlで機能しない

ここ
<LinearLayout android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:clickable="true" 
    android:focusable="false" 
    android:id="@+id/dragView" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="@dimen/bottom_height" 
     android:background="@color/bottom_grey_color" 
     android:paddingRight="@dimen/bottom_margin" 
     android:paddingLeft="@dimen/bottom_margin" 
     > 

     <include layout="@layout/cart_layout" 
      ></include> 


     <TextView 
      android:id="@+id/tvTotalPrice" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_weight="1" 
      android:textSize="14sp" 
      android:text="Rs: 20898789" 
      android:gravity="center_vertical" 
      android:textColor="@color/white" 

      android:layout_toRightOf="@+id/cart_layout" 
      android:paddingLeft="10dp"/> 

     <ImageView 
      android:layout_width="40dp" 
      android:layout_height="30dp" 
      android:layout_centerHorizontal="true" 
      android:src="@mipmap/bottom_bar" 
      /> 

     <Button 
      android:id="@+id/btnCheckout" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:textSize="14sp" 
      android:gravity="center_vertical|right" 
      android:text="Check Out" 
      android:textColor="@color/app_color" 
      android:layout_alignParentRight="true" 
      android:background="@color/white" 
      android:layout_marginTop="8dp" 
      android:layout_marginBottom="8dp" 
      android:paddingLeft="10dp" 
      android:paddingRight="10dp" 
      /> 

    </RelativeLayout> 
    <android.support.v7.widget.RecyclerView 
     android:id="@+id/list" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1"> 
    </android.support.v7.widget.RecyclerView> 

</LinearLayout> 

ここ

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.2" 
    defaultConfig { 
     applicationId "com.xxxxxxx" 
     minSdkVersion 16 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     externalNativeBuild { 
      cmake { 
       cppFlags "-frtti -fexceptions" 
      } 
     } 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    externalNativeBuild { 
     cmake { 
      path "CMakeLists.txt" 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 

    compile 'com.android.support:appcompat-v7:24.0.0-alpha1' 
    compile 'com.sothree.slidinguppanel:library:3.3.1' 
    compile 'com.android.support:design:24.0.0-alpha1' 
    compile 'com.google.code.gson:gson:2.2.4' 
    compile 'com.squareup.okhttp:okhttp:2.5.0' 
    compile 'com.squareup.retrofit:retrofit:1.9.0' 
    compile 'com.squareup.picasso:picasso:2.5.2' 
    compile 'com.android.support:support-v4:24.0.0-alpha1' 
    testCompile 'junit:junit:4.12' 
} 

は、スタイルファイル..ですGradleのファイル..です

<resources> 

    <!-- Base application theme. --> 
    <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar"> 
     <!-- Customize your theme here. --> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
     <item name="colorAccent">@color/colorAccent</item> 
    </style> 
    <style name="AppTheme.NoActionBar"> 
     <item name="windowActionBar">false</item> 
     <item name="windowNoTitle">true</item> 
    </style> 
    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> 
    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> 

</resources> 

カラーファイル...

<resources> 
    <color name="colorPrimary">#3F51B5</color> 
    <color name="colorPrimaryDark">#303F9F</color> 
    <color name="colorAccent">#FF4081</color> 
    <color name="white">#ffffff</color> 
    <color name="black">#000000</color> 
    <color name="bottom_grey_color">#b5b5b5</color> 
    <color name="app_color">#2e318e</color> 
    <color name="bg_color">#ebebeb</color> 
    <color name="cart_bg_color">#da0000</color> 
</resources> 

マニフェストコード..

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name=".Activity.MainActivity" 
     android:label="@string/app_name" 
     android:launchMode="singleTop" 
     android:screenOrientation="portrait" 
     android:theme="@style/AppTheme.NoActionBar" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
     <intent-filter> 
      <action android:name="android.intent.action.SEARCH" /> 
     </intent-filter> 
    </activity> 
</application> 

アウト置く: enter image description here

+0

マニフェストとcolor.xml plz – lRadha

+0

@IRadha nowチェック –

+0

ビューをどのように膨らませているかを表示できますか? –

答えて

1

はたぶん、あなたは値-V21のフォルダがあり、そこにテキストの色は、(変更またはしない)白いです。それをチェックし、私に知らせてください。私は同じ問題に遭遇しましたが、この方法で修正しました。

+0

これはV21-スタイル値であり、スタイル 除くファイルがない<スタイル名=" = AppTheme.NoActionBar "> <項目名=" windowActionBar ">偽 <項目名"windowNoTitle"> true true @ android:color/transparent

関連する問題