How to use custom buttons? [closed]

-1

I would like to know how to put more attractive buttons (edit your aesthetics) in the app and also how to add fonts?

    
asked by anonymous 20.03.2017 / 23:15

1 answer

1

To modify the source of a TextView for example: you must first add it to your project in android studio, as follows ...

1st = > Create the assets folder in app / src / main / assets ... If you have difficulty locating, change the view of your project:

2nd=>copythesource(.otfor.ttf)thatyouwanttothisassetsfolderthatyoucreated.

3rd=>inthecodeofyouractivitydeclarethesourceasfollows(intheexampleIusedthefontorange_juice):

Typefacefont=Typeface.createFromAsset(getAssets(),"orange_juice.ttf");

(if your source is .otf, then put .otf)

For the source to be effective in a CheckBox or TextView, just do the following:

Typeface font = Typeface.createFromAsset(getAssets(), "orange_juice.ttf");

CheckBox checkBox = (CheckBox)findViewById(R.id.checkBox);
TextView textView = (TextView)findViewById(R.id.textView);

checkBox.setTypeface(font);
textView.setTypeface(font);

(remember to add them to the layout before)

To modify the appearance of a button (if that's what I mean), just do the following:

1st = > add the image you want to the Drawables folder.

2nd = > in the properties of the button, select the background:

3rd=>selectthedesiredimage(inmycaselamp):

Ready! If you have anything else, comment.

    
21.03.2017 / 00:09