Android 快速开发之快速实现“我”界面
来源:互联网 发布:2017linux系统推荐 编辑:程序博客网 时间:2024/06/04 18:56
现在很多 APP 软件大部分都有我的 这个模块,然而今天给大家带来很方便的、快速的实现这个界面。效果图:
1、添加依赖
compile 'com.leon:lsettingviewlibrary:1.3.0'compile 'de.hdodenhof:circleimageview:2.1.0'
2、布局文件
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:leon="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="150dp" android:layout_marginBottom="16dp" android:background="#fff" android:gravity="center" android:orientation="vertical"> <de.hdodenhof.circleimageview.CircleImageView android:id="@+id/profile_image" android:layout_width="96dp" android:layout_height="96dp" android:src="@drawable/e" app:civ_border_color="#FFFFFF" app:civ_border_width="2dp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:padding="10dp" android:text="小飞象" android:textSize="16sp" /> </LinearLayout> <com.leon.lib.settingview.LSettingItem android:id="@+id/item_one" android:layout_width="match_parent" android:layout_height="wrap_content" leon:leftIcon="@drawable/ic_money" leon:leftText="钱包" /> <com.leon.lib.settingview.LSettingItem android:layout_width="match_parent" android:layout_height="wrap_content" leon:leftIcon="@drawable/ic_collect" leon:leftText="收藏" /> <com.leon.lib.settingview.LSettingItem android:layout_width="match_parent" android:layout_height="wrap_content" leon:leftIcon="@drawable/ic_photo" leon:leftText="相册" leon:rightStyle="iconHide"/> <com.leon.lib.settingview.LSettingItem android:id="@+id/item_four" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/MyCheckBox" leon:leftIcon="@drawable/ic_card" leon:leftText="卡包" leon:rightStyle="iconCheck"/> <com.leon.lib.settingview.LSettingItem android:id="@+id/item_five" android:layout_width="match_parent" android:layout_height="wrap_content" leon:leftIcon="@drawable/ic_face" leon:leftText="表情" /> <com.leon.lib.settingview.LSettingItem android:id="@+id/item_six" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/MyCheckBox" leon:leftIcon="@drawable/ic_setting" leon:rightStyle="iconSwitch" leon:leftText="设置" /> <com.leon.lib.settingview.LSettingItem android:layout_width="match_parent" android:layout_height="wrap_content" leon:isShowUnderLine="false" leon:leftIcon="@drawable/ofm_feedback_icon" leon:leftText="我的位置" leon:rightStyle="iconSwitch" /></LinearLayout>
3、styles.xml 添加 MyCheckBox
<style name="MyCheckBox" parent="AppTheme"> <item name="colorControlNormal">#CCCCCC</item> <item name="colorControlActivated">#0099CC</item></style>
4、MainActivity.java
package com.gyq.minedemo;import android.os.Bundle;import android.support.v7.app.AppCompatActivity;import android.widget.Toast;import com.leon.lib.settingview.LSettingItem;public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //对一个控件进行点击事件 LSettingItem one =(LSettingItem)findViewById(R.id.item_one); one.setmOnLSettingItemClick(new LSettingItem.OnLSettingItemClick() { @Override public void click() { Toast.makeText(MainActivity.this,"点击了钱包",Toast.LENGTH_SHORT).show(); } }); }}
阅读全文
0 0
- Android 快速开发之快速实现“我”界面
- Android开发之仿联系人界面(根据文字首字母A、B、C实现快速索引)
- 快速开发之统一界面管理类
- Tiny快速入门之Web界面快速开发实践
- Tiny快速入门之Web界面快速开发实践
- Android快速开发之Adapter
- Android快速开发之SuperTextView
- Android开发学习之快速实现圆角ListView
- android界面快速搭建
- [应用妹 --第一篇界面演示] android应用市场之快速开发
- [应用妹 --第二篇 主界面Tab搭建] android应用市场之快速开发
- [应用妹 --第三篇 主界面Tab搭建2] android应用市场之快速开发
- 快速开发设置界面-----PreferenceActivity
- HiTabs——Android Fragment界面框架快速开发
- Android开发 如何快速实现分享功能
- Android开发 何快速实现分享功能
- Android开发 如何快速实现分享功能
- Android开发 如何快速实现分享功能
- js 递归
- HDU2089:不要62 数位dp
- Python入门基础知识总结
- 【loj】#6003. 「网络流 24 题」魔术球(贪心)
- python zip( )
- Android 快速开发之快速实现“我”界面
- 判断一个字符串中出现次数最多的字符,统计这个次数
- 初识CSS动画与JS动画,强制同步布局
- Spring实现动态注入并按照类别获取相应实例的方法
- windows系统下华为HIKey960开发板使用Fastboot升级系统操作步骤
- 随机变量统计独立性的相关证明
- 拉手网Python程序员面试题
- ArrayBlockingQueue
- Android 四个基本组件的概念(只是概念)