教程锁屏布局控件摆放_第1页
教程锁屏布局控件摆放_第2页
教程锁屏布局控件摆放_第3页
已阅读5页,还剩5页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、锁屏布局控件摆放本楼中内容不会很复杂,着重利用例子分析代码,就用锁屏布局这个例子来讲解一下一楼中的一些 XML 知识。讲解的例子为 MiniCM7-2.2.0中的 framework-res.apk,其它 ROM 中可能会有点不同,但你了解代码意思后就可以改别的了。先来看一下修改前后的效果:要做的就是把左图中的时钟、网标、日期、闹钟时间等空间放到屏幕中间去,再把 3个 音 乐 控 制 按 钮 放 到 屏 幕 上 方 。 先 来 说 说 这 个 布 局 文 件 在 哪 里 , 反 编 译 framework-res.apk 后找到:framework-resreslayoutkeyguard_s

2、creen_tab_unlock.xml打开这个文件,并排列好:超级长的代码,大家蛋定,咱慢慢分析,我在文件中用注释的方式为大家解释代码,其实很多地方只需要添加以下居中属性,改一下大小,边距这些。内容太多很难为大家一一解释,但是我会把我改好的放上来,大家可以参考下,参照我这些解释大家可以试着修改一下来感受锁屏布局是怎样控制的。注意:是 XML 的注释方法。android.gesture.GestureOverlayViewandroid:orienion=noneandroid:id=id/gestures android:layout_width=fill_parent android:la

3、yout_height=fill_parentandroid:gestureStrokeType=multipleandroid:eventserceptionEnabled=falsexmlns:android= HYPERLINK http:/s/ http:/sandroid:gravity=center_horizontal android:id=id/rootandroid:background=#70000000 android:layout_width=fill_parentandroid:layout_height=fill_parentxmlns:tabunlock= HYP

4、ERLINK http:/s/ http:/sTextView android:textAppearance=?textAppearanceMedium.android.tabunlockandroid:textSize=22.0sp android:ellipsize=marqueeandroid:gravity=bottom|right|center android:id=id/carrierandroid:layout_width=wrap_content想要的,要把这里改为居中: android:layout_height=wrap_content android:layout_mar

5、ginLeft=8.0dipandroid:layout_margop=5.0dip android:layout_marginRight=8.0dip android:singleLine=true android:layout_alignParentTop=true android:layout_alignParentRight=true /TextView 让它居android:textAppearance=?textAppearanandroid:textColor=color/whitemallandroid:id=id/emergencyCallText android:layou

6、t_width=wrap_content android:layout_height=wrap_contentandroid:layout_marginLeft=8.0dipandroid:layout_margop=0.0dipandroid:layout_marginRight=8.0dipandroid:text=string/emergency_calls_only android:layout_below=id/carrier 还要再设置一下居中android:layout_alignParentRight=true /com.android.ernal.widget.Digital

7、Clock android:id=id/time android:paddingBottom=8.0dip android:layout_width=wrap_content android:layout_height=wrap_contentandroid:layout_marginLeft=20.0dip把这句改为只需要在这个控件的主android:layout_margop=10.0dipandroid:layout_marginRight=20.0dip android:layout_below=id/carrierandroid:layout_centerInParent=trueT

8、extView android:textAppearance=?textAppearanceMedium android:textSize=72.0spandroid:ellipsize=none android:id=id/timeDisplay android:layout_width=wrap_content android:layout_height=wrap_content android:layout_marginBottom=10.0dip android:singleLine=true android:shadowColor=#c0000000 android:shadowDx

9、=0.0 android:shadowDy=0.0 android:shadowRadius=3.0 /TextView android:textAppearance=?textAppearanceMedium android:textSize=22.0spandroid:ellipsize=noneandroid:id=id/am_pm android:layout_width=wrap_content android:layout_height=wrap_content android:layout_marginLeft=8.0dip android:singleLine=true and

10、roid:shadowColor=#c0000000 android:shadowDx=0.0 android:shadowDy=0.0 android:shadowRadius=3.0 android:layout_toRightOf=id/timeDisplayandroid:layout_alignBaseline=id/timeDisplay /TextView android:textAppearance=?textAppearanceMedium android:id=id/date android:layout_width=wrap_content android:layout_

11、height=wrap_content android:layout_marginLeft=24.0dip android:layout_marginRight=24.0dip android:layout_below=id/timeandroid:layout_centerInParent=true /LinearLayout android:orienion=verticalandroid:id=id/sus_boxandroid:layout_width=fill_parent android:layout_height=wrap_content android:layout_below

12、=id/dateTextViewandroid:textAppearance=?textAppearanceMedium android:ellipsize=endandroid:id=id/sus_chargingandroid:layout_width=wrap_content android:layout_height=wrap_contentandroid:layout_marginLeft=24.0dipandroid:layout_margop=4.0dipandroid:layout_marginRight=24.0dip android:maxLines=2android:dr

13、awablePadding=4.0dipandroid:layout_below=id/dateandroid:layout_centerInParent=true /TextView android:textAppearance=?textAppearanceMedium android:ellipsize=endandroid:id=id/sus_alarmandroid:layout_width=wrap_content android:layout_height=wrap_contentandroid:layout_marginLeft=24.0dipandroid:layout_ma

14、rgop=4.0dipandroid:layout_marginRight=24.0dip android:maxLines=2android:drawableLeft=drawable/ic_lock_idle_alarm android:drawablePadding=4.0dip android:layout_centerInParent=true /TextView android:textAppearance=?textAppearanceMedium android:ellipsize=end一张android:id=id/sus_calendarandroid:layout_wi

15、dth=wrap_content android:layout_height=wrap_contentandroid:layout_marginLeft=24.0dipandroid:layout_margop=4.0dipandroid:layout_marginRight=24.0dip android:maxLines=3 android:drawableLeft=drawable/ic_lock_idle_calendar,也就是那张日历的小图标 - android:drawablePadding=4.0dipTextView按钮放到屏android:textAppearance=?t

16、extAppearan android:id=id/customMsg android:layout_width=wrap_content android:layout_height=wrap_contentandroid:layout_marginLeft=24.0dipmallandroid:layout_margop=4.0dipandroid:layout_marginRight=24.0dipandroid:layout_below=id/sandroid:textAppearance=?textAppearanceMedium android:id=id/screenLocked

17、android:layout_width=wrap_content android:layout_height=wrap_contentandroid:layout_marginLeft=24.0dipandroid:layout_margop=12.0dipandroid:drawablePadding=4.0dip android:layout_below=id/customMsg /ImageButtonandroid:id=id/musicControlPlay android:background=color/transparent android:padding=10.0px 如果

18、想做到像android:visibility=gone android:layout_width=wrap_contentandroid:layout_height=wrap_content android:layout_marginBottom=10.0dip android:src=drawable/ic_media_play drawable 里面的 android:layout_alignParentBottom=true android:layout_centerInParent=true /ImageButton android:id=id/musicControlPause an

19、droid:background=color/transparentandroid:padding=10.0pxandroid:layout_alignParentBottom=true android:layout_centerInParent=true /ImageButton 幕下方,android:id=id/musicControlPrevious android:background=color/transparent android:padding=10.0px android:visibility=goneandroid:layout_width=wrap_contentand

20、roid:layout_height=wrap_content android:layout_marginRight=20.0dip 件像图中那样紧挨着,android:layout_marginBottom=10.0dip android:src=drawable/ic_media_previous android:layout_toLeftOf=id/musicControlPause android:layout_alignParentBottom=true /ImageButton android:id=id/musicControlNext android:background=co

21、lor/transparentandroid:padding=10.0px android:layout_marginLeft=20.0dip 像图中那样紧挨着,android:layout_marginBottom=10.0dip android:src=drawable/ic_media_next android:layout_toRightOf=id/musicControlPause android:layout_alignParentBottom=true /TextViewandroid:textAppearance=?textAppearan android:ellipsize=marqueeandroid:gravity=centermallandroid:id=owPla

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论