1

I am posting radial code for Gradient layout.. what can i use for linear layout ? Or in simple i need liner gradient layout in my android app background.. without using image ?

<?xml version="1.0" encoding="UTF-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
        <gradient 
            android:startColor="#93cc1a" 
            android:endColor="#6C9B06"
            android:type="radial"
            android:gradientRadius="326"
        />                
    </shape>
3
  • I'm not quite sure what you're asking, but does taking out the android:type and android:gradientRadius work? Commented Apr 28, 2011 at 10:11
  • yes i am asking for that ..:) Commented Apr 28, 2011 at 10:12
  • Refer My Blog, I had gave detailed Explanation there Here is the Link Commented Apr 28, 2011 at 10:24

2 Answers 2

2
<gradient android:type="linear" 
 android:startColor="#ffffff" 
 android:endColor="#005aa9" 
 android:angle="270.0" /> 

Are you asking about linear gradient?

Sign up to request clarification or add additional context in comments.

3 Comments

ya . its the code which i need... can you please explain about android:angle
anlge determs direction of gradient: 0 - vertical from startColor to endColor, 270 - vertical from endColor to startColor; 90 and 180 - horizontal, etc
You can also set android:centerColor if you wanted to, say, go from red to green to blue instead of just red to blue.
0

ya . its the code which i need... can you please explain about android:angle

  • 0 = left to right (startColor > endColor)
  • 90 = bottom to top (startColor > endColor)
  • 180 = right to left (startColor > endColor)
  • 270 = top to bottom (startColor > endColor)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.