Reputation: 253
have a SeekBar and I get the value of it whenever I scroll it. the position should then be the factor, how big the text in my spinner should be.
So I want to change the text size of my spinner items whenever I scroll not the 50sp as in my layout
My custom_list_row.xml
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textViewRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|left"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textSize="50sp" />
My Adapter
ArrayAdapter<Language> adapter = new ArrayAdapter<Language>(this, R.layout.custom_list_row,
currentLanguages);
spinnerLanguage.setAdapter(adapter);
the Language class is a Object with a toString method.
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
resizeViews(progress);
}
private void resizeViews(int progress){
textViewFirstName.setTextSize(20+progress);
//how can I do this for a spinner here?
}
Upvotes: 0
Views: 3403
Reputation: 295
You can use this.
private void resizeViews(int progress){
textViewFirstName.setTextSize(20+progress);
//this might be helpful
for(int i=0;i<spinnerLanguage.getChildCount();i++){
((TextView)spinnerLanguage.getChildAt(i)).setTextSize(20+progress);
}
}
Upvotes: 1