package com.ostrichmyself.eff;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ListView;
import android.widget.SimpleAdapter;
/**
* 这个是启动的Activity, 注意这个位置不能随便放, 只允许放在
* AndroidManifest.xml定义的<manifest>节点package描述的包中
* @author tiant5
*
*/
public class EffectiveAndroidActivity extends Activity {
private ListView itemlist;
private List<Map<String, Object>> list;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.parent_layout);
//通过下面的方式可以任意扩展parent_layout某个特定部分的UI
displaySpecialListView();
//下面的方式是用来说明Layout:weight的对其效果, 以及统一风格的EditText设计
openRegDlg();
}
private void displaySpecialListView()
{
LinearLayout specialUI = (LinearLayout)findViewById(R.id.specialUI);
LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
View listView = inflater.inflate(R.layout.listview_common,null);
LayoutParams para = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
specialUI.addView(listView, para);
itemlist = (ListView) findViewById(R.id.itemlist);
refreshListItems();
}
private void openRegDlg()
{
LayoutInflater factory=LayoutInflater.from(this);
//看看里面用到的统一风格, 查看代码注释
final View v1=factory.inflate(R.layout.dialog_register,null);
AlertDialog.Builder builder=new AlertDialog.Builder(this);
builder.setTitle("免费注册");
builder.setIcon(0);
builder.setPositiveButton("注册", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
//登录代码
}
});
builder.setNegativeButton("取消",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog al = builder.create();
al.setView(v1, 0, 0, 0, 0);
al.show();
}
public void refreshListItems() {
list = buildListForSimpleAdapter();
SimpleAdapter notes = new SimpleAdapter(this, list, R.layout.listview_item_common,
new String[] { "img", "title", "info" }, new int[] {R.id.img, R.id.title, R.id.info });
itemlist.setAdapter(notes);
itemlist.setSelection(0);
}
private List<Map<String, Object>> buildListForSimpleAdapter() {
list = new ArrayList<Map<String, Object>>(2);
// Build a map for the attributes
Map<String, Object> map = new HashMap<String, Object>();
map.put("img", R.drawable.service_personal_set);
map.put("title", "个人设置");
map.put("info", "(进行个人设置, 如修改密码等, 设置工况, 设置告警,非常状态,紧急情况等)");
list.add(map);
map = new HashMap<String, Object>();
map.put("img", R.drawable.service_position);
map.put("title", "位置服务");
map.put("info", "(位置服务, 如修改密码等, 设置工况, 设置告警,非常状态,紧急情况等)");
list.add(map);
map = new HashMap<String, Object>();
map.put("title", "产品反馈");
map.put("img", R.drawable.service_feedback);
map.put("info", "(产品反馈, 如修改密码等, 设置工况, 设置告警,非常状态,紧急情况等)");
list.add(map);
map = new HashMap<String, Object>();
map.put("title", "我的设备");
map.put("img", R.drawable.service_mydevice);
map.put("info", "(我的设备:产品反馈, 如修改密码等, 设置工况, 设置告警,非常状态,紧急情况等)");
list.add(map);
return list;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
Effecitive Android 设计
共38个文件
png:11个
class:10个
xml:8个
4星 · 超过85%的资源 需积分: 3 21 下载量 80 浏览量
2011-10-28
07:39:16
上传
评论
收藏 135KB ZIP 举报
温馨提示
总结了自己在Android项目实施中遇到的设计问题。 即如何更好的进行组织和设计, 让项目更加稳定, 更容易维护, 参见博客http://blog.csdn.net/ostrichmyself/article/details/6903058
资源推荐
资源详情
资源评论
收起资源包目录
EffectiveAndroid.zip (38个子文件)
EffectiveAndroid
.project 852B
proguard.cfg 1KB
src
com
ostrichmyself
eff
ui
EffectiveAndroidActivity.java 4KB
AndroidManifest.xml 822B
res
drawable-ldpi
icon.png 2KB
drawable-hdpi
icon.png 4KB
drawable-mdpi
service_position.png 5KB
icon.png 3KB
bg_list_item_common.png 5KB
bg_listview_common.png 7KB
service_mydevice.png 4KB
list_bg_common_unsel.png 5KB
service_feedback.png 5KB
service_personal_set.png 5KB
listview_selector_common.xml 948B
list_bg_common_sel.png 6KB
layout
listview_item_common.xml 1KB
dialog_register.xml 5KB
listview_common.xml 953B
parent_layout.xml 1KB
values
style.xml 250B
strings.xml 191B
assets
gen
com
ostrichmyself
eff
R.java 2KB
default.properties 362B
.classpath 280B
bin
resources.ap_ 35KB
EffectiveAndroid.apk 41KB
com
ostrichmyself
eff
R$layout.class 534B
R$style.class 460B
EffectiveAndroidActivity.class 5KB
EffectiveAndroidActivity$1.class 923B
R$drawable.class 792B
R$attr.class 349B
ui
R$id.class 640B
R.class 603B
R$string.class 436B
EffectiveAndroidActivity$2.class 917B
classes.dex 7KB
共 38 条
- 1
资源评论
- monlikey2012-07-06好书 好书 不过全英文的 考我英文的了 不过老外些的够detail
- li.ianfei2012-09-21晕,就一个小程序,哪来的什么书
- js-lc2014-11-09好书,值得看哦!
- gjjofsfe2016-06-20啥也没有啊,应该不要分。
x-teamer团队
- 粉丝: 1206
- 资源: 47
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功