广播分为普通广播、有序广播、异步广播,异步广播和普通广播类似,广播不能终止和处理,有序广播可终止可处理,并且三种都是级别高的先接收广播。
目标效果:
点击第一个按钮发送的是普通广播,第二个按钮发送的是有序广播。
1.activity_main.xml页面放置两个按钮。
activity_main.xml页面:
<RelativeLayout xmlns:android=...
分类:
移动开发 时间:
2016-05-12 23:30:30
阅读次数:
329
在项目开发中,我们经常需要进行动态添加组件,其中可添加的部分有两项:布局和组件
其中,添加的布局主要有RelativeLayout型(相对布局)的和LinearLayout(线性布局)
添加的组件主要有文本显示框,编辑框,按钮等组件。
下面,就让我们来进行实现:
首先我们创建一个新的项目,删除MainActivity.class中没有的代码,仅留下p...
分类:
移动开发 时间:
2016-05-12 23:23:01
阅读次数:
333
常见布局RelativeLayout(相对布局)
相对于父布局进行定位android:layout_centerHorizontal 横向居中
android:layout_centerVertical 纵向居中
android:layout_centerInParent 横向纵向居中
android:layout_alignParentLeft=”true”左上角
androi...
分类:
其他好文 时间:
2016-05-12 22:42:46
阅读次数:
199
Layout(CommonLayout,Adapter Layout)
CommonLayout普通布局
布局视图(ViewGroup Android UI中的)
Common Layout一般布局
padding 内边距margin 外边距scrollbars 滚动条
1)RelativeLayout (相对布局)
特征:
1. 每个控件都可以使用其它控件作为参考点,从而决...
分类:
移动开发 时间:
2016-05-12 21:56:09
阅读次数:
269
目标效果:
程序运行,手指在屏幕上从左往右或者从右往左滑动超过一定距离,就会吐司输出滑动方向和距离。
1.activity_main.xml页面放置一个ImageView控件。
activity_main.xml页面:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
...
分类:
移动开发 时间:
2016-05-12 19:23:50
阅读次数:
159
看了翔哥的blog,本篇blog来记录下github JazzyViewPager的使用。直接将JazzyViewPager的代码copy进项目中。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:too...
分类:
其他好文 时间:
2016-05-12 19:17:38
阅读次数:
213
现在不管什么APP都有个头像,如果你看见没有头像的APP就会感觉非常奇怪,以前头像都是方的,后来就变成圆的,我估计在过个几年就得来个五角星形状的头像,下面我把更换头像的代码写来:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.an...
分类:
移动开发 时间:
2016-05-12 19:13:30
阅读次数:
241
在项目开发中,我们有时候需要自定义状态栏通知的样式,以下就是自定义状态栏通知的一个案例代码,以此作为一个记录,有需要的童鞋也可以参考一下
状态栏通知布局custom_notification.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/r...
分类:
移动开发 时间:
2016-05-12 19:06:42
阅读次数:
247
目标效果:
点击图示按钮,可以根据提示内容进行判断网络是否连接,开关WIFI,获取音量值和获取进程包名。
1.activity_main.xml页面放置所有的Button控件。
activity_main.xml页面:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/and...
分类:
移动开发 时间:
2016-05-12 18:58:48
阅读次数:
272
1.直接通过URL网址打开网页显示内容:loadUrl()
首先在布局中写一个WebView的控件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.andro...
分类:
移动开发 时间:
2016-05-12 18:09:51
阅读次数:
251