There is such a picture As in the game 4 photos 1 word
I need to draw cells for letters. I do not remember the name of the style, it seems to me that Inner
, when the cell is concave inward.
And the fact is that I did not work with Photoshop
for drawing and use it with 9-Patch
. In the vast Internet did not find (or not properly searched).
So the question is how to draw such a button or cell in Drawable
?
2
Answers
All you need is here.
Very firstly you have to have this colors defined in your colors.xml in values folder.
Then you need to create one file in drawable folder say layout_corners_dark.xml and copy this code in this file.
Then you need to add button widgets in your activity_main.xml by applying layout_corners_dark.xml to it using
android:background
and your button xml will be like this
And apply silver background to your activity_main.xml using this line
android:background="@color/silveryBackground"
in your parent layoutFinally your activity_main.xml will look like this.
And this is screenshot of this layout.
See output here
1. Create a custom
drawable
filebg_rounded_corners.xml
forrounded
blackbox
shape and put thisdrawable
into yourres/drawable
folder.bg_rounded_corners.xml
2. Design your layout XML using
LinearLayout
withHorizontal
orientation and put desired number ofTextView
inside thisLinearLayout
. Set customdrawable
to eachTextView
using attributeandroid:background="@drawable/bg_rounded_corners"
.activity_main.xml
OUTPUT:
FYI, I have used color
#202531
asbackground
color. For your case, you can use anothercolor
or use anyimage
as background of rootLinearLayout
.Hope this will help~