How to change app background except textview's background? - android

I want change background for whole app except textviews.
So, I change style.xml
<item name="android:background">#color/colorRed</item>
But textviews change background too. For example, toast text appear on red background. As I understand, default textview background is transparent. Is there posibilitiy to change background without textviews?

Just add a background (android:background) to the text view on the xml file, like this
<TextView
android:background="android.R.color.white"
That background will not change because it's fixed.

Related

CardView background color doesn't change even after using app:cardBackgroundColor property

I am making effort to change my cardView background color to a different color other than the default color set in style with the colorSurface property.
I am aware colorSuface is responsible for a cardView color, but it is surprisingly difficult to change it color in XML.
I have tried the following singly and together but there is no effect.
android:background="#color/purple_200"
app:cardBackgroundColor="#color/purple_200"
android:backgroundTint="#color/purple_200"
I will appreciate help.
Here is my styles code
<item name="colorSurface">#color/app10</item>
The reason I don't want to change the colorSurface property is because, that is the default desired color I want for all cardView but in this particular layout, I want to style my row of cardView widgets with tones of a color, unfortunately, it is not responding.
I figured out the issue was the color set to an imageView inside the cardView was overlaying the color of the cardView.
Another possible cause of this kind of behaviour is if the cardView was inside a layout whose elevation (layout) is possibly greater than the cardView.
Thanks #Mike M for asserting that cardView doesn't disappoint in this case.

background color of custom notification with image buttons is black in 3.1 emulator

I have custom notification with linear layout that contains four image buttons.
I set the linear layout background color to transparent color #00000000 and also i set the background color of the four image buttons to transparent color #00000000.
As Expected, According to the transparent color of linear layout and image buttons, my custom notification background color must match the emulator notification background color(almost gray).
but actually the background of notification is still black.
My minimum sdk is 11 and target is 19
Note that the other previous questions not solved my problem.
Thanks in advance, Mostafa.
Try to use in your XML file
android:background="#android:color/transparent"
instead of #00000000

android change view's background color when state changes

how to use color state list for background?
I know android:background="#drawable/drawable_selector", but android:background="#color/color_selector" will cause exceptions.
but android:background="#FFFFFF" works again, can anyone explains why?
now i want to change a layout's background color(not a drawable) when it's pressed,
how to do it?
dynamically you can change like this. Use this if it is useful for you -
textView.setBackgroundColor(Color.parseColor(getResources().getString(R.string.red)));
put the color in res/values/colors.xml,
like #FFFFFF,
and then create a drawable xml in drawable directory,
,that is ok.

Android Application : Background Image over Background Color

I am new to android development and am developing my first android application. I have the background color of the View set in the layout's xml as follows.
android:background="#+color/bgColor"
Now, i have a full sized transparent background image that i want to lay over the background and then other Elements over that image.
is there a way i can use both background color and background image in the same layout.
Thanks in Advance.
You can use an ImageView with a background color:
<ImageView
layout_width="match_parent"
layout_height="match_parent"
src="#drawable/myImage"
background="#color/myBgColor" />
Another option is to set the background color in the root element of your layout, and keep the src in your ImageView.
I'm using AppCompatImageView. In this background color can be set using the below property.
android:backgroundTint="#color/colorPrimary"

How do I create a transparent textview on click at the bottom of the running screen?

How do I create a transparent textview on click at the bottom of the running screen?
Defining #00000000 the background, whereas the first 2 are it's alpha state (Transparency), and then the other 6 are RGB. Alpha is 00-FF.
Hope this helps!
If you mean make the textview invisible and being able to turn it visible, you can use this attribute in your xml textview :
android:visibility="invisible"
and then you can turn it visible with setvisibility().
now if you just want the background of your textview to be transparent, you have to define it's background color has #ffffffff

Categories

Resources