上拉加载
2016-03-20 20:15
183 查看
package com.example.shang;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class MainActivity extends ListActivity {
public static final String[] options = { "ListView", "ExpandableListView", "GridView", "WebView", "ScrollView",
"Horizontal ScrollView", "ViewPager", "ListView Fragment", "WebView Advanced", "ListView in ViewPager" };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, options));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
Intent intent;
switch (position) {
default:
case 0:
intent = new Intent(this, PullToRefreshListActivity.class);
break;
// case 1:
// intent = new Intent(this, PullToRefreshExpandableListActivity.class);
// break;
// case 2:
// intent = new Intent(this, PullToRefreshGridActivity.class);
// break;
// case 3:
// intent = new Intent(this, PullToRefreshWebViewActivity.class);
// break;
// case 4:
// intent = new Intent(this, PullToRefreshScrollViewActivity.class);
// break;
// case 5:
// intent = new Intent(this, PullToRefreshHorizontalScrollViewActivity.class);
// break;
// case 6:
// intent = new Intent(this, PullToRefreshViewPagerActivity.class);
// break;
// case 7:
// intent = new Intent(this, PullToRefreshListFragmentActivity.class);
// break;
// case 8:
// intent = new Intent(this, PullToRefreshWebView2Activity.class);
// break;
// case 9:
// intent = new Intent(this, PullToRefreshListInViewPagerActivity.class);
// break;
}
startActivity(intent);
}
}
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class MainActivity extends ListActivity {
public static final String[] options = { "ListView", "ExpandableListView", "GridView", "WebView", "ScrollView",
"Horizontal ScrollView", "ViewPager", "ListView Fragment", "WebView Advanced", "ListView in ViewPager" };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, options));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
Intent intent;
switch (position) {
default:
case 0:
intent = new Intent(this, PullToRefreshListActivity.class);
break;
// case 1:
// intent = new Intent(this, PullToRefreshExpandableListActivity.class);
// break;
// case 2:
// intent = new Intent(this, PullToRefreshGridActivity.class);
// break;
// case 3:
// intent = new Intent(this, PullToRefreshWebViewActivity.class);
// break;
// case 4:
// intent = new Intent(this, PullToRefreshScrollViewActivity.class);
// break;
// case 5:
// intent = new Intent(this, PullToRefreshHorizontalScrollViewActivity.class);
// break;
// case 6:
// intent = new Intent(this, PullToRefreshViewPagerActivity.class);
// break;
// case 7:
// intent = new Intent(this, PullToRefreshListFragmentActivity.class);
// break;
// case 8:
// intent = new Intent(this, PullToRefreshWebView2Activity.class);
// break;
// case 9:
// intent = new Intent(this, PullToRefreshListInViewPagerActivity.class);
// break;
}
startActivity(intent);
}
}
相关文章推荐
- 求职宝典 第六章 函数
- Leetcode #18 4Sum 四数之和 解题小节+K-Sum思想
- 第三周项目一-个人所得税计算器
- 任务十一:移动Web页面布局实践
- HDU 2795 Billboard(线段树,单点查询)
- C++的深拷贝实现
- 高项2016-03-14
- java对象数组
- android 手把手教您自定义ViewGroup(一)
- java 读取mysql库表数据
- IT行业2016研究分析
- 寄生组合继承
- maven的安装与测试(1)
- C++实现日期类
- BZOJ4390Max Flow
- 虚拟机的三种网络模式
- 关于HTML
- seajs的使用
- 解决在weblogic(可能与之无关)下jsp通过post传递中文内容表单乱码问题
- Problem B