下拉菜单字段值对应编号。通过相应编号得到字段值。
2015-12-09 14:37
330 查看
/**
* 提供存放在文件夹下的属性文件作为单表查询结果展示 的字段集
* @param path 属性文件的路径
* @return Bean实体封装类(String,String)
*/
public List getBeansList(String path) {
String Path = String.format(“data/%s.properties”, path);
List optionList = new ArrayList();
try {
InputStream in = getAssets().open(Path);
/**Util类中写入getBeanList方法,解析相应的.properties文件
* 此处省略了该类方法;
*/
return optionList = Util.getBeanList(in);
} catch (IOException e) {
return null;
}
}
* 提供存放在文件夹下的属性文件作为单表查询结果展示 的字段集
* @param path 属性文件的路径
* @return Bean实体封装类(String,String)
*/
public List getBeansList(String path) {
String Path = String.format(“data/%s.properties”, path);
List optionList = new ArrayList();
try {
InputStream in = getAssets().open(Path);
/**Util类中写入getBeanList方法,解析相应的.properties文件
* 此处省略了该类方法;
*/
return optionList = Util.getBeanList(in);
} catch (IOException e) {
return null;
}
}
/** * 提供存放在a文件夹下的属性文件作为下拉选的数据源 * @param path 属性文件的路径*(%s.properties)文件 * @param id 布局文件中下拉选的id */ public void getOption(String path, int id) { List<Bean> optionList = new ArrayList<Bean>(); try { InputStream in = getAssets().open(path); /**Util类中写入getBeanList方法,解析相应的.properties文件 * 此处省略了该类方法; */ optionList = Util.getBeanList(in); } catch (IOException e) { } Spinner me_Spinner = (Spinner) findViewById(id); ArrayAdapter<String> adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, optionList); adapter.setDropDownViewResource(R.layout.spinner_drop_item); me_Spinner.setAdapter(adapter); me_Spinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { View focus = parent.getSelectedView(); focus.setFocusable(true); focus.setSelected(true); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); }
相关文章推荐
- awk实现 文本内的换行符 为分隔符,输出变为逗号
- Firemonkey的旁门左道[六]
- 百宝云数组教程
- thinkphp整合ueditor上传功能
- Android初学习 - ViewPager与Fragment初步
- [javase学习笔记]-1.4 Java程序开发之初体验--Hello World
- pthread条件变量condition(配合mutex锁使用)
- [Cordova] Plugin里使用iOS Framework
- linux下通过acl配置灵活目录文件权限(可用于ftp,web服务器的用户权限控制)
- Android开发周报:Android Studio2.0发布、Activity动态创建
- 使用Java驱动操作Cassandra
- 访问win7上面的共享文件时,出现登陆失败:禁用当前用户的错误
- Mac OS X安装 Scrapy、PIL、BeautifulSoup
- python基础教程共60课-第14课字符串格式化
- 操作系统启动过程——硬件自检+系统引导+系统加载+系统登录
- 为何java一些方法会有横线?
- 多线程
- 夺命雷公狗---PDO NO:6 使用PDO执行SQL语句之query
- Kali Linux Web***测试之 WebSploit
- Kali Linux Web渗透测试之 WebSploit 推荐