I have an Android activity which has three buttons. I have set a color for the main activity LinearLayout‘s background via:
android:background="@color/homeBgColor"
I want to put up a translucent background image behind the buttons on the activity. I tried using an ImageView, but it pushes the buttons down.
Is there any way to set the background color as well as image for the activity, like we do in CSS?
#mydiv{ backround: #262626 url("link-to-my-img.png");}
Thanks
You should be able to achieve this with a
<layer-list />drawable. Within it, place an<item />which contains a<bitmap />(example stolen from the developer docs):Then, your other item can just be a solid color. Make a drawable resource that just has that solid color in it, then combine them:
(You may have to flip the order of the
<item />tags, I forget which is on top.)