更改微调器标题栏样式
如何更改微调器标题栏样式。
我想更改以下项目的标题栏:
icon title textsize,textColor and background color
我怎样才能做到这一点?
请帮助我…我搜索了谷歌和更多sites.am没有得到任何解决方案。所以请让我知道它的可能。如果可能的话,我怎么能发展这个????请解释我。
编辑:
这是我的代码:
ArrayAdapter adapter = new ArrayAdapter(this, R.layout.row, R.id.country, list); spinner.setPrompt("Choose a Status"); // spinner.setTextColor("#FF0000"); spinner.setAdapter(adapter); adapter.notifyDataSetChanged(); spinner.setOnItemSelectedListener(new MyOnItemSelectedListener()); }
你必须创建CustomSpinner,
为此,请尝试以下方式,它适合我
第1步:创建自定义微调器类
class CustomSpinnerAdapter extends CursorAdapter { LayoutInflater mInflater; private int cocktailname; CustomSpinnerAdapter(Context context, Cursor cursor) { super(context, cursor); mInflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); cocktailname = cursor.getColumnIndex(YourDatabase.CK_NAME); } @Override public View newDropDownView (Context context, Cursor cursor, ViewGroup parent) { return mInflater.inflate(R.layout.dropdownspinnertext, parent, false); } @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { return mInflater.inflate(R.layout.spinnertext, parent, false); } @Override public void bindView(View row, Context context, Cursor cursor) { //Setting the Value here TextView paymentname = (TextView) row.findViewById(R.id.text1); paymentname.setTypeface(textFont); String cocktail = cursor.getString(cocktailname); paymentname.setText(cocktail); } }
第2步:调用此适配器
CustomSpinnerAdapter custom_spinneradapter = new CustomSpinnerAdapter(this,youcursor); spnListCocktails.setAdapter(custom_spinneradapter); spnListCocktails.setOnItemSelectedListener(this);
用于dropdownnspinnertext的Xml
我正在使用Checked Dropdown Spinner
对于spinnertext.xml
希望能帮助到你
使用Java(代码):
spinner.setPrompt("Title")
要么
来自XML:
android:prompt="@string/spinner_title
看到这个改变风格
- Android webview.postUrl(url,Encodingutils.getBytes(postData,“BASE64”))从postdata字符串中删除“+”
- 在android imageview中顺利启动和停止背景音乐
- Android相机捕获产生绿色和块状video
- Android Studio w / gradle:包r不存在
- android图像视图内存不足错误
- Android TCP通信速度太慢
- 在Android中获取原始.APK文件的名称
- 将Java.Security.KeyPair转换为.NET RSACryptoServiceProvider
- 在Eclipse和Java中使用m4宏