Hi I'm covering my ImageView in buttons but while they are so close to each other you cant make out that it is buttons, its just a big red square. I need a quick and easy way to give my buttons borders/edges or something so you can see the different buttons.
Asked
Active
Viewed 6,654 times
2 Answers
6
Create a Shape in Drawable Resource
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#C0213A" />`<!--Background Color-->`
<stroke android:width="2dip" android:color="#C0213A"/> `<!--Border-->`
</shape>
In your XML
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="15dp"
android:background="@drawable/your_shape"> `<!--This is your shape created--`>

Chefes
- 1,892
- 18
- 17
3
There is no border for buttons but you can use shape to make a drawable with border then put it as background for the button.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/red" />
<stroke
android:width="1dp"
android:color="@color/black" />
</shape>

Orhan Obut
- 8,756
- 5
- 32
- 42