Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Background color in only (1/4)th portion of a View (Android)

Is it possible to set background color for only (1/4)th portion of a View in Android? I have a use case where I need to select a view and color it after dividing it in portions, Ive looked at developer docs but I am unable to find a way to do the same.

Edit: I need to make it banded something like "| | | |" and I need to do it dynamically.

like image 814
Arif Nadeem Avatar asked Jan 19 '12 06:01

Arif Nadeem


1 Answers

it is useful for you

 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
 android:shape="rectangle">
 <gradient
    android:startColor="#FFFFFF"
    android:endColor="#00000000"
    android:angle="45"/>    
</shape>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/gradient"  >   
</LinearLayout>
like image 54
NagarjunaReddy Avatar answered Sep 30 '22 13:09

NagarjunaReddy