更改文本颜色微调项目显示
我使用了简单的光标适配器来设置微调器的适配器,因为我使用了 sqlite 数据库。但我无法自定义微调器的字体颜色,
这是我的微调器有深红色背景,我想使用简单的光标适配器和微调器 android
代码将文本颜色更改为白色:
Cursor cursor = dbAdapter.getAllData();
if(cursor.getCount()>0){
String[] from = new String[]{"columm_name"};
// create an array of the display item we want to bind our data to
int[] to = new int[]{android.R.id.text1};
SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, cursor, from, to);
mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerName.setAdapter(mAdapter);
I have used simple cursor adapter to set adapter for spinner as i have used sqlite databse. but i am not able to customize the font color of the spinner,
Here is the Url of the my spinner has dark red background i want to change text color to white using simple cursor adapter with spinner android
code :
Cursor cursor = dbAdapter.getAllData();
if(cursor.getCount()>0){
String[] from = new String[]{"columm_name"};
// create an array of the display item we want to bind our data to
int[] to = new int[]{android.R.id.text1};
SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, cursor, from, to);
mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerName.setAdapter(mAdapter);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的问题的解决方案希望对其他人有帮助。
只需给这个textview android简单光标适配器代替android.R.layout.simple_spinner_item
solution to my question hope it will help others.
just give this textview android simple cursor adapter in place of android.R.layout.simple_spinner_item