教你搞定Android自定义ViewGroup
字数1794 阅读7030 评论8 喜欢37
上一篇我们介绍了Android中自定义View的知识,并实现了一个类似Google彩虹进度条的自定义View,今天我们将进一步学习如何去自定义一个ViewGroup。
ViewGroup
我们知道ViewGroup就是View的容器类,我们经常用的LinearLayout,RelativeLayout等都...
分类:
移动开发 时间:
2016-05-12 16:25:21
阅读次数:
266
性能优化:布局优化、绘制优化、内存泄漏优化、响应速度优化、ListView优化、Bitmap优化、线程优化等
1.布局优化
思想:尽量减少布局的层级,绘制工作量少,性能高
操作:1.删除布局中无用的控件和层级
2. 选择使用性能低的ViewGroup,比如LinearLayout、FrameLayout,RelativeLayout功能复杂,优先使用前两者
...
分类:
移动开发 时间:
2016-05-12 12:08:27
阅读次数:
194
在最外层使用 RelativeLayout作为根节点,同时设置 android:fitsSystemWindows="true"问题解决. <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://sche ...
分类:
移动开发 时间:
2016-05-10 23:15:41
阅读次数:
870
//布局 activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" andro ...
分类:
其他好文 时间:
2016-05-10 23:10:05
阅读次数:
272
菜单布局 新建工程MyMenu 新建class MainUI作为主UI 继承自RelativeLayout private Context context; private FrameLayout leftMenu; private FrameLayout middleMenu; private F ...
分类:
其他好文 时间:
2016-05-08 10:19:38
阅读次数:
258
第二类:属性值必须为id的引用名“@id/id-name” 仅RelativeLayout中有效 android:layout_below 在某元素的下方 android:layout_above 在某元素的的上方 android:layout_toLeftOf 在某元素的左边 android:la ...
分类:
移动开发 时间:
2016-05-07 12:41:07
阅读次数:
129
alert_dialog.Xml代码
xml version="1.0" encoding="utf-8"?>
RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
a...
分类:
移动开发 时间:
2016-05-07 08:19:23
阅读次数:
247
目标效果:
程序运行,显示一输入框和按钮,在输入框输入内容点击按钮会提示保存成功,关闭程序,再次打开会在输入框显示刚才输入的内容,并提示英文。
1.activity_main.xml页面放置两个控件。
activity_main.xml页面:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/...
分类:
移动开发 时间:
2016-05-07 07:48:37
阅读次数:
244
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_pa...
分类:
其他好文 时间:
2016-05-07 01:10:11
阅读次数:
191
先来看activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:swipe="http://schemas.android.com/apk/res-...
分类:
移动开发 时间:
2016-05-06 15:28:34
阅读次数:
243