android - Set the Textview size respective to the device screen size -
this question has answer here:
i searching long not successful . have came across issue many times somehow managed giving fixed sizes .
but there method , textview size increases depending on device screen size .
as far , using below code , facing sort of issue . want set larger size textappearancelarge
in below code .
<textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancesmall" />
if set fixed size , android:textsize="32sp"
may large screen sizes galaxy ace looks small in s3-like devices .
any related answers welcomed , in advance .
use /res/values/dimens.xml
different dimension like:
<resources> <!-- default screen margins, per android design guidelines. --> <dimen name="activity_horizontal_margin">30dp</dimen> <dimen name="activity_vertical_margin">30dp</dimen> <!-- login screens --> <dimen name="button_text_size">16sp</dimen> <dimen name="edittext_text">14sp</dimen> <dimen name="checkbox_text">13sp</dimen> <!-- slide bar --> <dimen name="slide_text_size">13sp</dimen> <dimen name="slide_button_text_size">15sp</dimen> <!-- city activity --> <dimen name="list_item_text_size">16sp</dimen>
now /res/values-sw600dp/dimens.xml
<resources> <!-- customize dimensions defined in res/values/dimens.xml (such screen margins) sw600dp devices (e.g. 7" tablets) here. --> <!-- login screens --> <dimen name="button_text_size">16sp</dimen> <dimen name="edittext_text">14sp</dimen> <dimen name="checkbox_text">14sp</dimen> <!-- slide bar --> <dimen name="slide_text_size">14sp</dimen> <dimen name="slide_button_text_size">16sp</dimen> <resources>
Comments
Post a Comment