Reputation:
I'm trying to create a button which is both transparent and has corner radius.Near the corners transparency is more than the rest of the button.How do I prevent it? I'm posting an image of it.
https://drive.google.com/file/d/0B8Yekz-VsuhmQzdQY0lfZHFONEU/view?usp=sharing`
<Button
android:layout_width="60pt"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/main_button_shapes"
android:text="@string/get_now"
android:textColor="@color/white"
android:layout_margin="10dp"
android:textStyle="bold" />
<resources>
<color name="mediumblue">#990000CD</color>
<color name="white">#ffffff</color></resources>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="30dp" />
<solid android:color="@color/mediumblue"/>
</shape>`
Upvotes: 1
Views: 1463
Reputation: 41
You can create a XML with:
<corners android:radius="15dp"/>
<solid android:color="@color/your_color"/>
Then use this XML like this:
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/xml_name"
/>
Upvotes: 0
Reputation: 162
The easiest way of your problem is creating ImageButtons. Do your imagebutton's background image. Then add your image into drawable folder.
Then use it like:
<ImageButton
android:id="@+id/mybutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:src="@drawable/mybuttonbackimage" />
Don't forget use android:background="@null" for transparency of button.
Upvotes: 3