Getting TextView color in xml - android

How to get theme text color in layout xml? android:textColor="?attr/editTextColor" works for EditText color but I cannot find value for default text (TextView) color. I want to get text color to use in other elements.

If You Are Using Android Studio, Then Press Ctrl+B or Command+B (For Mac) On The Resource Name You Want to go to. As You are finding colour for textView. Then press ctrl + B, it will redirect you to the default style xml of android. You Can Find Shades There.
I find out default shades from the same source of course as Google has not given is every value of shades for every View.
Reply me back if it really helps you.
Happy Coding.

Related

EditText onClick() "indicator" color

I am currently trying to change the design of an EditText in Android Studio - specifically some colors. I was able to change the color of the cursor, the underline and the text, but not of the following object:
This "indicator" appears if one clicks at previously entered text (e.g. changing position of the cursor).
My questions are:
(1) What is this "Indicator" called? (Sorry if this is a duplicate. It's hard to search for something I don't know the name of)
(2) How can I retrieve the drawable of it, so I can add a color filter?
Thank you very much!
You need the change the accent color in your app's style.xml file. The style.xml resource file contains a style with the name "AppTheme" that are referenced from the app’s AndroidManifest.xml file to specify the app’s theme.
Setandroid:colorAccent to your desired color and you are good to go.
It depends on your colorAccent. Change your colorAccent code according to your choice and get edittext indicator same.

How to show html code on button in Android and style it

I want to put html codes on buttons as text in my android application and style them.
For ex: I want to create a help button and put "❔" as text to it.
Below is the code I have written in the activity.
Button btHelp=((Button) findViewById(R.id.btHelp));
btHelp.setText(Html.fromHtml("❔"));
But if I want to change the color of it. I tried by giving span and font in the above statement but it is not applying.
Can you please let me know how to give the colors for this. Also let me know if there is any better way to do so.
Thanks,
If you want to change text color, simply use:
btnHelp.setTextColor(Color.parseColor("#FF0000"));
or
btnHelp.setTextColor(Color.RED);
or
btnHelp.setTextColor(getResources().getColor(R.color.red));
But that won't work with emojis like your White Question Mark Ornament. If you want to change that question mark color, you will have to make a drawable file with button drawables (png) that have that question mark with the color you want. You can do that from photoshop or any other program.

what is the color used in seekbar

I am trying to find the color code for the bright light blue color used by the Android framework in some of their widgets. I understand that the framework uses 9 patch images to draw these widgets, so the color code would theoretically not be stored in the framework code.
But is there a way to find what was the color code used in the SeekBar or the ToggleButton(the small blue line when Checked)?
I generally use #33B5E5 for the color.
Take a screenshot of the image and upload it to this site and click the color you want to know about.
http://html-color-codes.info/colors-from-image/
In Android-Studio you can do it in the Program itself too. To do that, follow this steps:
Put the Item in your view that you wish to know the color from or have a picture or screenshot ready and open on the PC
Select an item (Button, View, etc) in the "Component-Tree" on right side and go to the "Color-Property" or the prop "Backgroud" of the selected item (one has to be in Design-Mode to see the Component-Tree).
Then click the "..." behind the Property-Edittextfield and a menu opens up where you can choose a color, by either go to the System-Tab and choose a predefined Android-System Color (you see all the different greens here for example). After select a color you see the value of it in the value window below.
You can also go to the Color-Tab and click the little color-selector item, then hover it over the Layout-item that you draged to the view in step 1 and try to hover the spot where the needed color is. You can have also a screenshot open, or the android emulator or something. The color-picker lets you hover also over outside program views, not only insde Androidstudio.
Voila, there you have all system colors.

Android, change only clicked color of a button

I would like to change the default orange color that appears when someone press an Android button. I have done many searches but all I found was the use of selectors.
I understand the principle, but I don't want to modify the grey aspect of the normal button (not pressed). But using selectors force to define all characteristics of all aspects (pressed or not).
I don't know how to obtain the default aspect of buttons in the light theme, so can anyone tell me where I can find the original parameters of the light theme or at least give me another means to simply change the color of the button when clicked?
You can copy the Android's selector into your project, the one that Android sets it by default to buttons, and modify only the state when the button is pressed by just changing one single drawable.
You could find the file in \android-sdk\platforms\android-10\data\res\drawable\btn_default.xml
Sorry bro...........
i guess only selector will help you......
You must go with selector.....
and selector are reusable xmls you can use in all buttons.....:)
You can refer below link.
:)
http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList
I tried to find a solution to this problem, but did not succeed.
Maybe this will help:
How to modify the default button state in Android without affecting the pressed and selected states?
Standard Android Button with a different color

Android change TextField outline/boarder color

I have a text field, and on Android 2.2, when it is in focus or being used, it highlights it and puts an orange boarder around it.
The orange really doesn't look good with the other colors in my app, so I am wondering if there is any way to change that to a different color...
Thanks in advance.
You can write selectors for your textview using which you can change the appearance of your textview when it is selected.
You can refer to this:
http://developer.android.com/reference/android/content/res/ColorStateList.html

Categories

Resources