Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/188.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Api级别为24时,文本颜色在xml中不起作用_Android_Xml_Android Layout_Textcolor_Android 7.0 Nougat - Fatal编程技术网

Android Api级别为24时,文本颜色在xml中不起作用

Android Api级别为24时,文本颜色在xml中不起作用,android,xml,android-layout,textcolor,android-7.0-nougat,Android,Xml,Android Layout,Textcolor,Android 7.0 Nougat,我面临的一个基本问题是,当我设置api级别24时,TextView和按钮的文本颜色没有从xml更改。它在预览中显示更改的颜色,但在设备上安装应用程序时不会显示,我还没有找到任何解决方案,即使我不知道为什么会出现这种情况,这是我的xml文件 <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"

我面临的一个基本问题是,当我设置api级别24时,
TextView
按钮的文本颜色没有从xml更改。它在预览中显示更改的颜色,但在设备上安装应用程序时不会显示,我还没有找到任何解决方案,即使我不知道为什么会出现这种情况,这是我的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>
这是样式文件

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

#3F51B5
#303F9F
#FF4081
#ffffff
#000000
#B5
#2e318e
#埃贝布
#达万
清单代码

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

可能您有values-v21文件夹,其中的文本颜色为白色(或未更改)。检查一下,让我知道。我也遇到了同样的问题,但通过这种方式解决了。

manifest和color.xmlplz@IRadha现在,检查是否可以显示如何扩大视图?在NoActionBar主题资源中添加
parent=“AppTheme”
,like:false-true这是v21样式的值,除了样式false-true-true@android:color/transparent之外没有其他文件
    <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>