android:textColor not working for TextView

android:text color codes xml
android:textcolor black
how to change text color in string.xml in android
android textview change color on touch
set text color in android textview
change text color android
how to set text color in android programmatically
android textview background color programmatically

android:textColor doesn't seem to work for TextView inside a nested LinearLayout. I had a look at the question at Textcolor selector not working. But it is also not working in my case. Following is my layout file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".CreateActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="15dp">

        <TextView
            android:id="@+id/lblTitle"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_gravity="end"
            android:layout_weight="0.9"
            android:hint="Title:"
            android:textAlignment="textEnd"
            android:textSize="24sp"
            android:textColor="#000000"/>

        <EditText
            android:id="@+id/lblTitleEdit"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="10dp"
            android:layout_marginLeft="10dp"
            android:hint="Enter your title here"
            android:layout_weight="0.4"
            android:inputType="text"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="15dp">

        <TextView
            android:id="@+id/lblVenue"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_gravity="end"
            android:layout_weight="0.9"
            android:hint="Venue:"
            android:textAlignment="textEnd"
            android:textSize="24sp"
            android:textColor="#000000"/>

        <EditText
            android:id="@+id/lblVenueEdit"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="10dp"
            android:layout_marginLeft="10dp"
            android:hint="Enter your venue here"
            android:layout_weight="0.4"
            android:inputType="text"/>

    </LinearLayout>
</LinearLayout>

Am I making any mistake here? Any help would be greatly appreciated.

You used hint as text here. So you have to apply color to your hint with the following code. or you can also change hint to text in your xml.

android:textColorHint="#000"

Not able to change text color on android 6.0 � Issue #474 � stripe , Hello. i've tried to change text color in app theme and it works for hint but Is that one also not working, @SiarheiSm ? We pull the "cached text color" (the non- error version) from a call to TextView#getTextColors() , (see the� Seems like the android:textColor will override all textviews' color, It looks like an android's defect for me, but anyway, put @null to your BottomSheet's style will correct this before new release came out. or use textColorPrimary instead of textColor in your application theme.

Add android: text, you give hint property and try to text color change

android:text="Title:"

Stylinging text color does not work when android:textColor is set , Well, this is very interesting. Seems like the android:textColor will override all textviews' color, It looks like an android's defect for me, but anyway,� Set a text color in XML and Java – android:textColor and setTextColor() All we have to do to set text color in XML is to add one more attribute called android:textColor to TextView tag. As its value we could put #RGB, #ARGB, #RRGGBB, #AARRGGBB color value or reference to color saved in colors.xml ( all is explained in the appendix ).

Please check this

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".CreateActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="15dp">

        <TextView
            android:id="@+id/lblTitle"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_gravity="end"
            android:layout_weight="0.9"
            android:text="Title:"
            android:textAlignment="textEnd"
            android:textSize="24sp"
            android:textColor="#000000"/>

        <EditText
            android:id="@+id/lblTitleEdit"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="10dp"
            android:layout_marginLeft="10dp"
            android:hint="Enter your title here"
            android:layout_weight="0.4"
            android:inputType="text"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="15dp">

        <TextView
            android:id="@+id/lblVenue"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_gravity="end"
            android:layout_weight="0.9"
            android:text="Venue:"
            android:textAlignment="textEnd"
            android:textSize="24sp"
            android:textColor="#000000"/>

        <EditText
            android:id="@+id/lblVenueEdit"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="10dp"
            android:layout_marginLeft="10dp"
            android:hint="Enter your venue here"
            android:layout_weight="0.4"
            android:inputType="text"/>

    </LinearLayout>
</LinearLayout>

How to change a color of text and background in Android TextView?, In this lesson we just focus on using colors, not defining them. All we have to do to set text color in XML is to add one more attribute called In Java all we need is setBackgroundColor() method working in the same way as� Home » Android » Android – Setting TextView to Bold Not Working Android – Setting TextView to Bold Not Working Posted by: admin May 10, 2020 Leave a comment

For android:text="Title:" you should use android:textColor="#000000"

And

For android:hint="Title:" you should use android:textColorHint="#000000"

Happy Coding.

Hi there, I am adding the android textcolor attribute and it does not , I am writing this: android:textColor="@android:color/white" /> and nothing! android:background="@android:color/black" > <TextView android:id="@+id/ textView1" Hey, remove the /> after textSize and it should work. But If I click on the Text, it is not call my method. The same method is working with a <button> tag but not with my TextView. Anybody an idea? greets

You are trying to give text color to android: hint and replace it with android: text.

See the answer below

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".CreateActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="15dp">

        <TextView
            android:id="@+id/lblTitle"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_gravity="end"
            android:layout_weight="0.9"
            android:text="Title:"
            android:textAlignment="textEnd"
            android:textSize="24sp"
            android:textColor="#000000"/>

        <EditText
            android:id="@+id/lblTitleEdit"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="10dp"
            android:layout_marginLeft="10dp"
            android:hint="Enter your title here"
            android:layout_weight="0.4"
            android:inputType="text"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="15dp">

        <TextView
            android:id="@+id/lblVenue"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_gravity="end"
            android:layout_weight="0.9"
            android:text="Venue:"
            android:textAlignment="textEnd"
            android:textSize="24sp"
            android:textColor="#000000"/>

        <EditText
            android:id="@+id/lblVenueEdit"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="10dp"
            android:layout_marginLeft="10dp"
            android:hint="Enter your venue here"
            android:layout_weight="0.4"
            android:inputType="text"/>

    </LinearLayout>
</LinearLayout>

Android: Working with themes and styles | by Joanne Kao, Suppose this is our TextView: android:textColor="@color/purple" By working with themes, updating your app's look and feel becomes a piece of cake. textColorTertiary : Not generally used (set to textColorSecondary in� The font size defined in the dimensions file might not have been picked up during run. Guess you are not running the app in emulator. Check the following to ensure that its not device thing. ensure the font size is correctly defined for the right dimensions file for the target device metrics; Some devices allows changing default text size.

Android Development Blog, TextView"> <item name="android:textColor">@color/pink</item> </style> be overridden in app's theme, however, if they are not, the system either uses a they didn't work since they are consumed by the TextView widget. I am fine with visualizing the fonts (created at runtime), but I would like to see the rest of the layout - and as of now I can only do so by changing IconicsTextView to Textview manually each time, and then changing it back again to run

Working with the TextView, This guide will take a look at the TextView and discuss common properties associated with this view as well as how to setup custom typefaces. The android:textColor and android:textColorLink attribute values are Issues with ListView. layout_above not working correctly in a relative layout I have a login screen where a user can enter his email. Then he can choose between either 'login' (still has to be changed to 'next') and 'forgot password'.

TextView, android:textAppearance, Base text color, typeface, size, and style. The TextView does not auto-size text (default). fonts that are used in displaying the text (which is needed to avoid text from consecutive lines running into each other) .

Comments
  • Use android:text="Title:" instead of android:hint="Title:"
  • Possible duplicate of Textcolor selector not working
  • Thanks for pointing out. I already had a look a the question and it was not working for me. So, while posting the question I have added it in the description that the solution didn't work me. Anyways, I found out my mistake. I was using android:hint instead of android:text
  • @harshpamnani if you are satisfied with my answer, then please upvote my answer or accept it, this will motivate me to help.
  • upvote done. However, I could not accept, as I have already another answer before this. Sorry.
  • @harshpamnani okay.
  • @harshpamnani if you have any doubts regarding the android, feel free to ask me, I am always ready to help anytime.