I want to have 3 edittext with top and bottom having topleft and topright curves but bottom-left and bottom-right straight. I tried to use shape
but it makes all the corners curved. If i try to use bottomRightRadius, then i get exception.
So I tried different way of doing it
using -ve margin so that bottom on hides the upper one's curve. But now bottom one is going behind the upper开发者_开发问答 one. There is nothing like goToBottom or goToTop :(
Any help is appreciated
Try to set radius of corners you want to see not rounded to the value near to 0 (but not 0):
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#eeffffff" />
<corners android:bottomRightRadius="5dip"
android:bottomLeftRadius="5dip" android:topRightRadius="0.1dip"
android:topLeftRadius="0.1dip"/>
</shape>
You have to set the android:radius attribute to at least 1dip in order to get any rounded corner displayed.
Then you go like this.
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<corners
android:radius="1dip"
android:topLeftRadius="10dip"
android:topRightRadius="10dip"
android:bottomLeftRadius="0dip"
android:bottomRightRadius="0dip" />
</shape>
You save this as your background.xml in the drawable subdir. Then you set it as the EditText's background using
android:background="@drawable/background"
This should get you your desired output.
精彩评论