在声明实例化一个listview,并已经将数据myshow[]放入listview之中。现在想在点中listview里面某个内容之后的,更换掉listview的内容,显示另一个数组的内容。感觉这部分的操作很常用,但是好难找到这部分操作的代码或者是讲解。难道大家不是用这用方法的吗显示内容的吗?
谢大家为我解疑,不胜荣幸。
public class MainActivity extends Activity {
private CharSequence myshow[] = {"快乐大本营","O记快餐","大碗饭"};
private Spinner mealchoose = null;
private ListView showList = null;
private CharSequence promt = null;
ArrayAdapter<CharSequence> shopAdapter = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
showList = (ListView) super.findViewById(R.id.shoplist);
shopAdapter = new ArrayAdapter<CharSequence>(this,android.R.layout.simple_expandable_list_item_1,this.myshow);
showList.setAdapter(shopAdapter);
showList.setOnItemClickListener(new ShopReaction());
mealchoose = (Spinner) super.findViewById(R.id.spinner);
promt = "choose";
mealchoose.setPrompt(promt);
mealchoose.setOnItemSelectedListener(new mealReaction());
} private class ShopReaction implements OnItemClickListener{
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
}
}listviewandroid
谢大家为我解疑,不胜荣幸。
public class MainActivity extends Activity {
private CharSequence myshow[] = {"快乐大本营","O记快餐","大碗饭"};
private Spinner mealchoose = null;
private ListView showList = null;
private CharSequence promt = null;
ArrayAdapter<CharSequence> shopAdapter = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
showList = (ListView) super.findViewById(R.id.shoplist);
shopAdapter = new ArrayAdapter<CharSequence>(this,android.R.layout.simple_expandable_list_item_1,this.myshow);
showList.setAdapter(shopAdapter);
showList.setOnItemClickListener(new ShopReaction());
mealchoose = (Spinner) super.findViewById(R.id.spinner);
promt = "choose";
mealchoose.setPrompt(promt);
mealchoose.setOnItemSelectedListener(new mealReaction());
} private class ShopReaction implements OnItemClickListener{
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
}
}listviewandroid
解决方案 »
- Android的两个tween动画(比如移动和渐变)有没有办法叠加显示?
- 新手请教界面布局的一个小问题.
- android cupcake中framework-res.apk下图片不能调用。。
- 这个Activity有什么错误呢????
- android 版本升级
- 求助资料~~~
- 跪求火狐android开源浏览器源码,怎么下载,不会
- 我要实现一个程序(A)启动 另外一个程序(B),在b程序里触发事件让B进入后台,再次显示回A(a不要执行oncreate方法 ),然后a在唤醒b,b不要执行on
- 安卓X864.3,配27寸显示屏,如何全屏显示
- 怎么分享内容到微信朋友圈的代码
- 在安卓下用c语言,来执行adb shell,生成so文件释放接口给上层
- 求指教ZAKER类似WinPhone界面是怎么做的?
long id) {中会出现报错,而且这种方法虽然说能实现我说的功能,但是这样子的话,会出现一定浪费资源。