Can't override default text color (android)

I only want to have one list view with a different text color and not the default. I can override the text size, style and background color of the line, but the text color remains the default theme. Can anyone tell me what I am doing wrong? These are my styles.xml:

<resources>

<!--
    Base application theme, dependent on API level. This theme is replaced
    by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->

</style>

<style name="rowstyle" parent="@style/rowbackground">
   <item name="android:textColor">#FFFFFF</item>
   <item name="android:textSize">25sp</item>
   <item name="android:textStyle">bold</item>
</style>

<style name="rowbackground" >
   <item name="android:background">@drawable/row_background</item>
   <item name="android:paddingLeft">15dp</item>
</style>

</resources>  

      

And this is action_main.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.houstone.MainActivity" >

<ListView
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_centerHorizontal="true"
  android:layout_below="@+id/countries"      
  android:id="@+id/cities"
  style="@style/rowstyle"/>
</RelativeLayout>

      

+3


source to share


1 answer


I ran into this problem myself. The solution is to set android:theme

in ListView

instead style

, for example the OP did



0


source







All Articles