Reputation: 27
In API 19 buttons cover the whole screen while API 23 doesn't cover.How to make API 23 buttons cover whole screen while maintaining API 19 buttons covering whole screen
Upvotes: 1
Views: 119
Reputation: 591
You will need to use dimens
file for supporting multiple screens. You can view official documentation for supporting multiple dimens here https://developer.android.com/guide/practices/screens_support.html
Edit :
Create new values folder with name as values-hdpi, values-xhdpi, values-xxhdpi, values-xxxhdpi.
Then add the button size in dimens file as below
values-hdpi
<dimen name="btn_click_me_width">18dp</dimen>
<dimen name="btn_click_me_height">18dp</dimen>
values-xhdpi
<dimen name="btn_click_me_width">24dp</dimen>
<dimen name="btn_click_me_height">24dp</dimen>
and similarly for other folders
You can calculate the size for different version here http://jennift.com/dpical.html
and in your layout file change button width as below
android:layout_width="@dimen/btn_click_me_width"
Upvotes: 1