I have an activity with a gradient background. Inside this activity there is a linerar layout containing three text views. This layout's background color is black. I want see the activity's gradient background through the textviews. But if I set textview background to transparent then it will be black color, which is linear layout's background color. how can I make textviews to see activity's gradient color?
Related
I am new in android. I want change my all relative layout background color on selection of navigation drawer item (change Background) at runtime.
You just need to get a reference from your relative layout and call the
method setBackgroundColor()
RelativeLayout layout = (RelativeLayout) findViewById(R.layout.id);
layout.setBackgroundColor(getResources().getColor(android color or your color));
I was wondering which views have background #null by default and on which views it's recommended to add it in order to reduce the number of overlays? For example in the following construct:
relativelayout
relativelayout
framelayout
view
If I want a white background (where only one view in the xml has this background - no overlaying of white on white), and I only define 'background white' for the highest relativelayout - will all the other layouts have a background "layer" or not (if none is specified)?
I am using the this code to have section/headers in list.
http://w2davids.wordpress.com/android-sectioned-headers-in-listviews/
I am setting the color with 50% alpha to list header and my window background color is transparent. So while scrolling header color becomes dark. Any idea how to overcome this.
and i have also set android:cacheColorHint="#00000000".
I had the same problem. I set the background color of the header view to the same background colour as the list's parent and it worked.
So I had a LinearLayout with a background colour of 'grey'.
The list is contained within this layout.
The list had android:cacheColorHint="#00000000" set in the XML and no background colour set.
The header view is loaded using LayoutInflater, inside my activity and set before the call to the list's setListAdapter.
The parent View (or main View) of the list header was also a LinearLayout with a background colour of 'grey'.
Hope this works for you.
I have followed the article Layout Tricks: Using ViewStubs to set a View on top of another. I used FrameLayout as the root element containing one MapView and a ViewStub. At the place for ViewStub I later opened a LinearLayout with the android:background set to a color with color value <color name="blue_opaque">#f005</color>.
The position for the LinearLayout seem to be right, it sits on top and it has a blue background but it is not transparent. What am I doing wrong?
The color hex code is built like this. #ARGB or for a more fine grained control #AARRGGBB which means AlphaRedGreenBlue. You set your alpha to 100% be opaque. Try #6005.
How can i make shadow effect in linear layout in android ?
You could insert a text view below with the background set to a gradient image.