1.控件配置 xml中有趣的属性:
android:background
可以通过以下两种方法设置背景为透明:"@android:color/transparent"和"@null"。注意TextView默认是透明的,不用写此属性,但是Buttom/ImageButton/ImageView想透明的话就得写这个属性了。
android:drawingCacheQuality
设置绘图时半透明质量。有以下值可设置:auto(默认,由框架决定)/high(高质量,使用较高的颜色深度,消耗更多的内存/low(低质量,使用较低的颜色深度,但是用更少的内存)。
android:fadingEdge
设置拉滚动条时 ,边框渐变的放向。none(边框颜色不变),horizontal(水平方向颜色变淡),vertical(垂直方向颜色变淡)。
android:fadingEdgeLength
设置边框渐变的长度。
android:scrollbarDefaultDelayBeforeFade
设置N毫秒后开始淡化,以毫秒为单位。
android:scrollbarFadeDuration
设置滚动条淡出效果(从有到慢慢的变淡直至消失)时间,以毫秒为单位。Android2.2中滚动条滚动完之后会消失,再滚动又会出来,在1.5、1.6版本里面会一直显示着。
android:scrollbarThumbHorizontal
设置水平滚动条的drawable。
android:scrollbarThumbVertical
设置垂直滚动条的drawable.
android:scrollbarTrackHorizontal
设置水平滚动条背景(轨迹)的色drawable
android:scrollbarTrackVertical
设 置垂直滚动条背景(轨迹)的drawable注意直接设置颜色值如”android:color/white”将得出很难看的效果,甚至都不理解这个属性 了,这里可以参见ApiDemos里res/drawable/scrollbar_vertical_thumb.xml和 scrollbar_vertical_track.xml,设置代码为:android:scrollbarTrackVertical ="@drawable/scrollbar_vertical_track"
android:soundEffectsEnabled
设置点击或触摸时是否有声音效果
android:visibility
设置是否显示View。设置值:visible(默认值,显示),invisible(不显示,但是仍然占用空间),gone(不显示,不占用空间)

2.很经典的一个layout.xml

Xml代码
  1. <?xmlversion="1.0"encoding="utf-8"?>
  2. <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
  3. android:orientation="vertical"android:layout_width="fill_parent"
  4. android:padding="8px"android:background="@color/lightblue"
  5. android:layout_height="fill_parent"android:gravity="center_horizontal">
  6. <LinearLayoutandroid:orientation="vertical"
  7. android:layout_width="fill_parent"android:layout_height="wrap_content">
  8. <TextViewandroid:text="@string/qr_main_contents"
  9. android:textColor="@color/black"android:layout_width="wrap_content"
  10. android:layout_height="wrap_content"/>
  11. <Spinnerandroid:id="@+id/qr_main_contents"
  12. android:layout_width="wrap_content"android:layout_height="wrap_content"
  13. android:entries="@+array/qr_main_contents"android:prompt="@string/qr_main_contents"/>
  14. </LinearLayout>
  15. <LinearLayoutandroid:layout_width="fill_parent"
  16. android:layout_weight="1"android:layout_height="wrap_content"
  17. android:scrollbars="vertical">
  18. <ScrollViewandroid:layout_width="fill_parent"
  19. android:layout_height="fill_parent">
  20. <LinearLayoutandroid:layout_width="fill_parent"
  21. android:layout_height="wrap_content"android:orientation="vertical">
  22. <TextViewandroid:text="@string/qr_information_name"
  23. android:textColor="@color/black"android:layout_width="wrap_content"
  24. android:layout_height="wrap_content"/>
  25. <EditTextandroid:id="@+id/qr_information_name"
  26. android:textColorHint="@color/blue"android:singleLine="true"
  27. android:layout_width="fill_parent"android:layout_height="wrap_content"/>
  28. <TextViewandroid:text="@string/qr_information_company"
  29. android:textColor="@color/black"android:layout_width="wrap_content"
  30. android:layout_height="wrap_content"/>
  31. <EditTextandroid:id="@+id/qr_information_company"
  32. android:singleLine="true"android:layout_width="fill_parent"
  33. android:layout_height="wrap_content"/>
  34. <TextViewandroid:text="@string/qr_information_phone"
  35. android:textColor="@color/black"android:layout_width="wrap_content"
  36. android:layout_height="wrap_content"/>
  37. <EditTextandroid:id="@+id/qr_information_phone"
  38. android:singleLine="true"android:layout_width="fill_parent"
  39. android:layout_height="wrap_content"/>
  40. <TextViewandroid:text="@string/qr_information_email"
  41. android:textColor="@color/black"android:layout_width="wrap_content"
  42. android:layout_height="wrap_content"/>
  43. <EditTextandroid:id="@+id/qr_information_email"
  44. android:singleLine="true"android:layout_width="fill_parent"
  45. android:layout_height="wrap_content"/>
  46. </LinearLayout>
  47. </ScrollView>
  48. </LinearLayout>
  49. <LinearLayoutandroid:orientation="vertical"
  50. android:gravity="right"android:layout_width="fill_parent"
  51. android:layout_height="wrap_content">
  52. <Buttonandroid:text="@string/qr_main_generate"
  53. android:layout_width="wrap_content"android:layout_height="wrap_content"/>
  54. </LinearLayout>
  55. </LinearLayout>

3.去掉页面的标题栏和信息栏
this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏

注意,这个设置必须放在设置布局前面,不然会报错.
setContentView(R.layout.entrancebs);

更多相关文章

  1. [原]Android(安卓)Native Debug
  2. android 夜间模式
  3. EditView、ImageView、Button
  4. Android横屏竖屏切换的问题
  5. Android中实用小知识
  6. Android(安卓)Studio的安装
  7. Android设置Settings:ListPreference【3】
  8. Android学习笔记(二三): 多页显示-Flipper的使用
  9. Android(安卓)ListView 设置分割线的设置

随机推荐

  1. Android使用Retrofit上传单个文件以及多
  2. Android(安卓)EditText获取焦点事件
  3. android如何在子线程中更新UI
  4. 记录代码合并时产生的bug
  5. Android中一些错误
  6. 常用的android弹出对话框
  7. android之ListView与Adapter(结合JavaBea
  8. android日期控件显示
  9. android webview在弹出软键盘时,布局没有
  10. Android(安卓)md5加密