一、自定义进度条 1.<ProgressBar
????????android:id="@+id/patch_progress"
????????style="@style/gxProgressStyle"
????????android:layout_width="match_parent"
????????a...
分类:
其他好文 时间:
2015-09-08 20:26:32
阅读次数:
246
Android开发中,常会遇到侧滑翻页的效果,android.support.v4.view.ViewPager让这种实现变得简单易用,但是通常使用时,都是让ViewPager的宽和高去match_parent,或者布局时制定了ViewPager的高度,所以一切正常。偶然的一次布局改变,着实一头雾水了半天。 场景:页面某个区域显示ViewPager用来翻页,但是ViewPager中的试图并不是设计...
分类:
其他好文 时间:
2015-09-06 14:43:38
阅读次数:
138
Android的组件要去使用布局的灵活性并适应各种尺寸的屏幕,应使用wrap_content和match_parent控制某些视图组件的宽度和高度。使用wrap_content,系统就会将视图的宽度和高度设置成所需的最小尺寸以适应视图中的内容,而match_parent(在低于API级别8的级别中称为fill_parent)..
分类:
移动开发 时间:
2015-09-04 22:42:29
阅读次数:
252
代码实现后界面如图:一。xml文件1.<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"android:id="@+id/relativelayout"><TextVie..
分类:
其他好文 时间:
2015-09-03 11:39:51
阅读次数:
246
官方地址:http://developer.android.com/guide/practices/screens_support.html一、关于布局适配建议1、不要使用绝对布局2、尽量使用match_parent 而不是fill_parent 。3、能够使用权重的地方尽量使用权重(android...
分类:
移动开发 时间:
2015-09-02 18:56:21
阅读次数:
326
Spinner:
是类似下拉列表的一种控件,用户从中选择相应选项!
Spinner中的数据需要使用Adapter(适配器)填充。
使用:
布局文件activity_main.xml:
<Spinner
android:id="@+id/spinner"
android:layout_width="match_parent"
...
分类:
移动开发 时间:
2015-09-01 09:16:12
阅读次数:
214
代码地址下载
activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
andro...
分类:
其他好文 时间:
2015-08-30 14:27:37
阅读次数:
203
参考资料:
首先新建一个layout文件,命名为moredata.xml,包含一个Button和一个ProgressBar,xml代码如下:
<?xmlversion="1.0"encoding="utf-8"?>
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
a..
分类:
其他好文 时间:
2015-08-27 19:08:20
阅读次数:
381
在布局文件中添加如下代码: <android.support.v7.widget.Toolbar
android:id="@+id/toobar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:backgro...
分类:
移动开发 时间:
2015-08-26 12:08:42
阅读次数:
199
上两篇文章主要讲述了view的measure过程,主要分析了xml文件中控件的height和width设置成不同值的时候,经过测量之后,如何计算出控件的真实高度。所以也就验证了我们经常所说的measure过程就是把match_parent等值转化成在具体设备上的具体的值。
本文主要分析一下layout的过程,同样我们以LinearLayout的layout过程为例。
在ViewR...
分类:
其他好文 时间:
2015-08-19 16:44:06
阅读次数:
121