2016-10-03 3 views
0

API 레벨 24를 설정할 때 TextView 및 의 텍스트 색상이 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> 

Gradle을 파일입니다 .. 여기

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' 
} 

는 스타일 파일입니다 ..

<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

manifest 및 color.xml plz – lRadha

+0

@IRadha now 체크 –

+0

보기를 팽창시키는 방법을 보여줄 수 있습니까? –

답변

1

은 어쩌면 당신은 값-V21 폴더와 텍스트 색상이 (변경 없음) 화이트되어 있습니다. 확인하고 알려주세요. 나는 똑같은 문제를 겪었지만 이렇게 수정했다.

+0

는 V21 스타일의 값과 스타일을 제외하고 파일 <스타일 이름 =이 없다"AppTheme.NoActionBar "> <항목 이름 ="windowActionBar "> 거짓 <항목 이름 = "windowNoTitle"> true true @ android : color/transparent

관련 문제