59、微信-我-设置SettingActivity
2016-05-09 10:49
555 查看
<?xml version="1.0" encoding="utf-8"?> <LinearLayout android:gravity="center_horizontal" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <include layout="@layout/layout_title" /> <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbars="none"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/txt_usersafe" style="@style/TxtTitle" android:textSize="16sp" android:gravity="center_vertical" android:background="@drawable/setting_item_selector" android:layout_width="fill_parent" android:layout_height="50dp" android:paddingLeft="16dp" android:paddingRight="10dp" android:layout_marginTop="20dp" android:drawableRight="@drawable/right" android:text="账号安全" /> <View android:background="@color/black2" android:layout_width="fill_parent" android:layout_height="1.0dip" /> <TextView android:id="@+id/txt_msgtip" style="@style/TxtTitle" android:textSize="16sp" android:layout_marginTop="20dp" android:gravity="center_vertical" android:background="@drawable/setting_item_selector" android:layout_width="fill_parent" android:layout_height="50dp" android:paddingLeft="16dp" android:paddingRight="10dp" android:drawableRight="@drawable/right" android:text="新消息通知" /> <View android:background="@color/black2" android:layout_width="fill_parent" android:layout_height="1.0dip" /> <TextView android:id="@+id/txt_yinsi" style="@style/TxtTitle" android:textSize="16sp" android:gravity="center_vertical" android:background="@drawable/setting_item_selector" android:layout_width="fill_parent" android:layout_height="50dp" android:paddingLeft="16dp" android:paddingRight="10dp" android:drawableRight="@drawable/right" android:text="隐私" /> <View android:background="@color/black2" android:layout_width="fill_parent" android:layout_height="1.0dip" /> <TextView android:id="@+id/txt_tongyong" style="@style/TxtTitle" android:textSize="16sp" android:gravity="center_vertical" android:background="@drawable/setting_item_selector" android:layout_width="fill_parent" android:layout_height="50dp" android:paddingLeft="16dp" android:paddingRight="10dp" android:drawableRight="@drawable/right" android:text="通用" /> <View android:background="@color/black2" android:layout_width="fill_parent" android:layout_height="1.0dip" /> <TextView android:id="@+id/txt_about" style="@style/TxtTitle" android:textSize="16sp" android:layout_marginTop="20dp" android:gravity="center_vertical" android:background="@drawable/setting_item_selector" android:layout_width="fill_parent" android:layout_height="50dp" android:paddingLeft="16dp" android:paddingRight="10dp" android:drawableRight="@drawable/right" android:text="关于微信" /> <View android:background="@color/black2" android:layout_width="fill_parent" android:layout_height="1.0dip" /> <LinearLayout android:gravity="center" android:padding="20.0dip" android:layout_width="fill_parent" android:layout_height="80.0dip"> <Button android:textColor="@color/white" android:id="@+id/btnexit" android:background="@drawable/btn_bg_red2" android:padding="10.0dip" android:layout_width="fill_parent" android:layout_height="40.0dip" android:text="退出登录" /> </LinearLayout> </LinearLayout> </ScrollView> </LinearLayout>
布局设计可以借鉴,代码比较简单:
public class SettingActivity extends BaseActivity implements View.OnClickListener { private TextView txt_title, txt_tip; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_setting); findViewById(); initViews(); setOnListener(); } @Override protected void onResume() { super.onResume(); } @Override protected void onDestroy() { super.onDestroy(); } private void findViewById() { findViewById(R.id.img_back).setVisibility(View.VISIBLE); findViewById(R.id.txt_right).setVisibility(View.GONE); txt_title = (TextView) findViewById(R.id.txt_title); txt_title.setText("设置"); } private void initViews() { } private void setOnListener() { findViewById(R.id.img_back).setOnClickListener(this); findViewById(R.id.btnexit).setOnClickListener(this); findViewById(R.id.txt_msgtip).setOnClickListener(this); findViewById(R.id.txt_usersafe).setOnClickListener(this); findViewById(R.id.txt_yinsi).setOnClickListener(this); findViewById(R.id.txt_about).setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.img_back: Utils.finish(SettingActivity.this); break; case R.id.txt_about: Utils.start_Activity(SettingActivity.this, WebViewActivity.class, new BasicNameValuePair(Constants.Title, "关于微信"), new BasicNameValuePair(Constants.URL, "https://github.com/motianhuo/wechat")); break; case R.id.btnexit: EMChatManager.getInstance().logout();// 退出环信聊天 Utils.RemoveValue(context, Constants.LoginState); Utils.RemoveValue(context, Constants.UserInfo); Utils.RemoveValue(context, Constants.NAME); Utils.RemoveValue(context, Constants.PWD); App.getInstance2().exit(); Utils.start_Activity(this, LoginActivity.class); break; default: break; } } @Override protected void initControl() { // TODO Auto-generated method stub } @Override protected void initView() { // TODO Auto-generated method stub } @Override protected void initData() { // TODO Auto-generated method stub } @Override protected void setListener() { // TODO Auto-generated method stub } }
相关文章推荐
- 58、微信-我-我的二维码MyCodeActivity
- 57、微信-我Fragment_Profile
- 微信开发全局返回码说明
- 微信入坑第二弹【自动回复消息下】
- 微信公众平台(测试接口)准备工作
- 我对于微信文章的感悟
- 微信入坑第二弹【自动回复消息上】
- PHP微信开发之微信消息自动回复下所遇到的坑
- 若有多台服务器且未部署全局session 用传值方法进入微信公众号
- 微信对接注意事项-jar设置
- 微信对接AES解密问题
- 第三讲 微信商城云服务器后台创建
- 微信入坑第一弹【微信接口配置】
- 第二讲:公众号平台接口配置及调试
- 微信商城开发实战 代码下载地址
- 微信公众平台OAuth2.0网页授权认证及卡券功能开发
- 微信公众平台开发-自定义菜单
- 微信开发之消息接收--图片消息(六)
- .net下4款不错的微信SDK
- 微信开发之消息接收--文本消息(五)