RelativeLayout第一类:属性值为true可falseandroid:layout_centerHrizontal 水平居中android:layout_centerVertical 垂直居中android:layout_centerInparent 相对于父元素完全居中android:l...
分类:
其他好文 时间:
2015-05-22 19:05:29
阅读次数:
216
跟手滑动很多开发者对布局的跟手滑动不太了解,在此就举一个例子,看一个RelativeLayout的滑动显示原理无论是跟手滑动,还是弹入弹出动画,本质上都是修改View或ViewGroup的位置,也即是setX() setY()这两个方法。
跟手滑动
跟手滑动是指,当用户在屏幕上滑动时,某一块布局,随着手指的滑动而滑动。所以,它的实现原理就是在onTouch事件中动态获得手指滑动的距离,然后修改vie...
分类:
移动开发 时间:
2015-05-22 17:10:34
阅读次数:
162
之前开发的项目在4.X完美运行,可是用户升级到5.0以上就出现莫名的bug。以下是修改bug中总结的差异化!(持续更新)
1,此处View 必须是LinearLayout或者RelativeLayout等ViewGroup。在4.X中可以是View,5.0以后View设置无效。 /**
* 设置控件相对于屏幕高度或者宽度
* @param context 上下文
* @par...
分类:
移动开发 时间:
2015-05-22 11:34:46
阅读次数:
146
Android中登录界面的记住密码功能实现,将用户输入的账号和密码以SharedPreferences方式存储(注意的是,密码要用MD5明文加密)。
界面xml文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.and...
分类:
移动开发 时间:
2015-05-20 22:31:34
阅读次数:
393
Android的布局风格 布局应该从外往里写
1.LinearLayout(线性布局)
xml version="1.0" encoding="utf-8"?>
LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"...
分类:
移动开发 时间:
2015-05-20 16:30:25
阅读次数:
218
在一些电子商务网站上经常能够看到一些滚动的广告条,许多软件在首次使用时也有类似的广告条,如图:其实在github上有实现这种效果的控件,不过这东西做起来也是很简单,我们今天就来看看该怎么做。先来看看布局文件:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http:...
分类:
移动开发 时间:
2015-05-19 16:34:09
阅读次数:
187
布局文件activity_main.xml<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:la...
分类:
移动开发 时间:
2015-05-18 18:56:57
阅读次数:
159
Android自定义视图教程Android的UI元素都是基于View(屏幕中单个元素)和ViewGroup(元素的集合),Android有许多自带的组件和布局,比如Button、TextView、RelativeLayout。在app开发过程中我们需要自定义视图组件来满足我们的需求。通过继承自Vie...
分类:
移动开发 时间:
2015-05-18 14:23:48
阅读次数:
219
关于android:id="@+id/" 和 android:id="@id/"的问题
本以为自己已经理解了这两个,无非就是第一次创建id时用+id/呗
但是没想到这里创建顺序是严格按照代码顺序来的,如:在RelativeLayout中
````
android:layout_above="@id/widget_2"
````/>
andro...
分类:
移动开发 时间:
2015-05-16 21:51:32
阅读次数:
185
android在 5.0中添加了阴影效果主要通过CardView来实现,在低版本中通过android.support.v7.widget.CardView来实现。<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk...
分类:
移动开发 时间:
2015-05-16 20:37:34
阅读次数:
130