用户界面优化
来源:互联网 发布:蜀汉 知乎 编辑:程序博客网 时间:2024/05/19 18:43
一.Android Fragment
1.认识 Fragment
A Fragment
represents a behavior or a portion of user interface in an Activity
. You can combine multiple fragments in a single activity to build amulti-pane UI and reuse a fragment in multiple activities. You can think of a fragment as amodular section of an activity, which has its own lifecycle, receives its own input events, andwhich you can add or remove while the activity is running (sort of like a "sub activity" thatyou can reuse in different activities).
2.Fragment 生命周期
3.带侧边栏的 Activity
二.Android 基本布局
1. LinearLayout (线性布局)
2. RelativeLayout (相对布局)
3. FrameLayout (帧布局)
三.Android RecyclerView
1.Android RecyclerView 的用法
2.Android RecyclerView 横向布局
3.Android RecyclerView 垂直布局
4.Android RecyclerView 表格布局
<span style="color:#333333;">package com.gst.user.application;import android.os.Bundle;import android.support.v7.app.AppCompatActivity;import android.support.v7.widget.LinearLayoutManager;import android.support.v7.widget.RecyclerView;import android.view.View;import android.view.ViewGroup;import android.widget.TextView;public class TempActivity extends AppCompatActivity{ RecyclerView recyclerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); recyclerView=new RecyclerView(this); setContentView(recyclerView); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setAdapter(new RecyclerView.Adapter() { @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new MyViewHolder(new TextView(parent.getContext())); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { MyViewHolder myViewHolder= (MyViewHolder) holder; ((MyViewHolder) holder).getTextView().setText("Item:"+position); } @Override public int getItemCount() { return 100; } }); } class MyViewHolder extends RecyclerView.ViewHolder{ TextView textView; public MyViewHolder(View itemView) { super(itemView); textView= (TextView) itemView; } public TextView getTextView() { return textView; } }}</span>
四.Android 常用控件
1.下拉列表2.日期选择器
3.时间选择器
4.单项选择
5.多项选择
五.Android用户界面优化-Android SlidingMenu菜单栏程序设计开发
六.Android通用下拉刷新控件的使用
七.Android用户界面优化-Android绘图API开发自定义视图控件
1.自定义视图的属性与控件皮肤。attrs.xml
<?xml version="1.0" encoding="utf-8"?><resources> <declare-styleable name="MyView"> <attr name="rect_color" format="color"/> </declare-styleable></resources>
- MyRect.Java
package com.gst.user.application;import android.content.Context;import android.content.res.TypedArray;import android.util.AttributeSet;import android.view.View;/** * Created by user on 1/27/16. */public class MyRect extends View { public MyRect(Context context, AttributeSet attrs) { super(context, attrs); TypedArray typedArray=context.obtainStyledAttributes(attrs,R.styleable.MyView); int color=typedArray.getColor(R.styleable.MyView_rect_color,0xffff0000); setBackgroundColor(color); typedArray.recycle(); } public MyRect(Context context) { super(context); }}
- content_temp.xml
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:gst="http://schemas.android.com/apk/com.gst.user.application.MyRect" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:showIn="@layout/activity_temp" tools:context="com.gst.user.application.TempActivity"> <com.gst.user.application.MyRect android:layout_width="200dp" android:layout_height="200dp" gst:rect_color="#ff0000ff" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="38dp" /></RelativeLayout>
八.Android用户界面优化-Android自定义视图动画
1.透明动画
- Java文件
AlphaAnimation alphaAnimation=new AlphaAnimation(0,1); alphaAnimation.setDuration(1000); view.startAnimation(alphaAnimation);
- xml文件定义alpha——anim.xml
<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"> <alpha android:fromAlpha="0" android:toAlpha="1" android:duration="1000"/></set>
Animation animation= AnimationUtils.loadAnimation(this, R.anim.alpha_anim); view.startAnimation(animation);
2.自定义动画效果
package com.gst.user.application;import android.view.animation.Animation;import android.view.animation.Transformation;/** * Created by user on 1/28/16. */public class CustomAnim extends Animation { @Override protected void applyTransformation(float interpolatedTime, Transformation t) {// t.setAlpha(interpolatedTime); t.getMatrix().setTranslate((float) (10*Math.sin(interpolatedTime*60)),0); super.applyTransformation(interpolatedTime, t); } @Override public void initialize(int width, int height, int parentWidth, int parentHeight) { super.initialize(width, height, parentWidth, parentHeight); }}
九.Android用户界面优化-Android创建和配置布局动画
1.为布局/列表添加/改变动画效果。
RelativeLayout layout= (RelativeLayout) getLayoutInflater().inflate(R.layout.content_temp,null); ScaleAnimation animation=new ScaleAnimation(0,1,0,1); animation.setDuration(1000); LayoutAnimationController controller=new LayoutAnimationController(animation,0.5f); layout.setLayoutAnimation(controller);
2.使用资源文件配置布局动画。
<?xml version="1.0" encoding="utf-8"?><layoutAnimation android:animation="@anim/layout_anim" android:delay="0.5" xmlns:android="http://schemas.android.com/apk/res/android"></layoutAnimation>
十.Android知识点-点9切图法在Android UI设计中的运用
安卓Drawable图片资源访问是界面开发中必不可缺的一部分,另外,很多应用需要实现屏幕适配,使用九宫格切图法可完美完成此任务.1. Drawable不同分辨率的认知与访问。
2.九宫格切图法的优势与运用。
十一.Android ViewPager引导页-Android专题
十二.Android 侧滑菜单之 DrawerLayout 的使用
1.DrawerLayout 的基本使用2.Fragment 的动态创建
3.Action Bar 的基本使用
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); Toast.makeText(MainActivity.this,"onDrawerOpened",Toast.LENGTH_SHORT).show(); } @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); Toast.makeText(MainActivity.this,"onDrawerClosed",Toast.LENGTH_SHORT).show(); } };
十三.Android 中 Action Bar 的使用
1.在程序中启用 Action Bar2.在 Action Bar 中添加按钮
<activity android:name=".TempActivity" android:label="@string/title_activity_temp" android:theme="@style/AppTheme.NoActionBar" > <meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".MainActivity"></meta-data> </activity>
getActionBar().setDisplayShowHomeEnabled(true);
3.自定义 Action Bar Style
4.开启 Overlay Mode
5.使用 ActionBarSherlock 开源库
6.使用一键生成工具 Android Action Bar Style Generator
十四.Android Surface View绘图API详解
1.使用SurfaceView API绘制单个和多个图形。
2.使用SurfaceView API绘制组合图形。
十五.Android中的消息通知Toast和Notification
1.掌握Toast的使用方法。
2.掌握Notification的使用方法。
十六.Android项目开发实战:自定义左右菜单
1.布局的添加
2.事件分发机制
3.滚动添加
4.蒙版添加
十七.Android项目开发实战:2D翻转
1.ScaleAnimation
2.AnimationListener
- 用户界面优化
- 性能优化之快速响应的用户界面
- 性能优化之快速响应的用户界面
- 性能优化之快速响应的用户界面
- 性能优化之快速响应的用户界面
- 性能优化之快速响应的用户界面
- 性能优化之快速响应的用户界面
- [学习笔记]用户界面优化之Android Fragment
- [学习笔记]用户界面优化之Android ViewPager
- 用户界面
- 用户界面
- 用户界面
- 用户界面
- 用户界面
- Android 用户界面编程技巧和设计模式(性能优化)
- Android用户界面之常用控件ListView 详解加优化
- web 优化——快速反应的用户界面(三)
- Android用户界面优化-Android SlidingMenu菜单栏程序设计开发
- 欢迎使用CSDN-markdown编辑器
- Win7下Python操作MySQL步骤
- CentOS7 mysql
- 融云,发送位置,腾讯地图改为高德地图,SOSOLocationActivity 核心类修改
- sizeof结构体
- 用户界面优化
- STM8全局变量溢出问题解决
- Linux曲径通幽:文件系统、硬盘分区、SWAPFILE、磁盘配额
- HDU1158
- Swift plugin for CLion
- xcode 显示编译时间
- USACO 4.2 Drainage Ditches 网络流SAP算法
- iOS开发笔记--超全!iOS 面试题汇总
- POJ 1019(递推)