android - Changing the text size of a spinner -
android - Changing the text size of a spinner -
i beginner in android programming.
i trying alter text size of spinner mentioned in question here. have created my_spinner_style.xml in res/values/ below:
<textview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/spinnertarget" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textcolor="#000000" android:textsize="13sp" /> and used adapter this:
spinner = (spinner)findviewbyid(r.id.spinner); arrayadapter<charsequence> adapter=arrayadapter.createfromresource(this,r.array.answers,android.r.layout.my_spinner_style); spinner.setadapter(adapter); spinner.setonitemselectedlistener(this); and tried creating style.xml in layout folder. adapter not recognize my_spinner_style. have placed in wrong directory?
it should r.layout.my_spinner_style, remove android @ start, makes point android bundle , not project.
note r you're importing project's resources, saying android.r points android resources, not project.
// edit how have sizes based on screen size
dimens.xml under values (default):
<resources> <!-- font sizes in sp --> <dimen name="small_font">14sp</dimen> <dimen name="big_font">20sp</dimen> </resources> dimens.xml under values-fr (french, in case, you'll have screen size qualifiers)
<resources> <!-- font sizes in sp --> <dimen name="small_font">16sp</dimen> <dimen name="big_font">22sp</dimen> </resources> then in textview example, font size:
<textview android:id="@+id/textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="@dimen/small_font"> </textview> now font size dependent on language (english goes values , french goes values-fr) should have same thing using screen size qualifiers.
android android-layout spinner android-spinner
Comments
Post a Comment