private ArrayAdapter<String> monthadapter = new ArrayAdapter<String>(this,R.layout.spinner, SalesPlannerArrayList.monthYearAray);
monthadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spn_monthList.setAdapter(monthadapter);
monthadapter.notifyDataSetChanged();
int setPostion=SalesPlannerArrayList.monthIdArray.indexOf(intentMonthId);
spn_monthList.setSelection(setPostion);
Create spinner.xml in layout folder and write down the following........
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerItemStyle"
android:singleLine="true"
android:textSize="14sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee" />
Changing the font in spinner ------------->
ccrAdapter = new ArrayAdapter<String>(this,R.layout.spinner,combineArray)
{
@Override
public View getView(int position, View convertView,ViewGroup parent) {
View view=super.getView(position, convertView, parent);
TextView chk=(TextView) view.findViewById(android.R.id.text1);
chk.setTypeface(font1);
return view;
}
};
ccrAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spnChemist.setAdapter(ccrAdapter);
ccrAdapter.notifyDataSetChanged();
No comments:
Post a Comment