今天看别人项目的时候,突然发现自己的界面布局这块实在是弱得很,所以特意上网找了一些布局方面的文来看,下面为了便于以后翻阅,特意转载过来。
android:布局参数,控件属性及各种xml的作用
|
ProgressBar
style="?android:attr/progressBarStyleHorizontal"
style="?android:attr/progressBarStyleLarge"
style="?android:attr/progressBarStyleSmall"
style="?android:attr/progressBarStyleSmallTitle"
其它一些参数:
android:excludeFromRecents="true"为true表示长按home键将显示此应用
android:screenOrientation="portrait" 永远竖屏显示
android:screenOrientation="portrait" 永远横屏显示
android:configChanges="keyboardHidden|orientation"竖屏切换横屏时应用也能弹出界面
分隔符
横向:
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="?android:attr/listDivider" />
纵向:
<View android:layout_width="1dip"
android:layout_height="fill_parent"
android:background="?android:attr/listDivider" />
CheckBox
style="?android:attr/starStyle"
类似标题栏效果的TextView
style="?android:attr/listSeparatorTextViewStyle"
其它有用的样式
android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingRight="?android:attr/scrollbarSize"
style="?android:attr/windowTitleBackgroundStyle"
style="?android:attr/windowTitleStyle"
android:layout_height="?android:attr/windowTitleSize"
android:background="?android:attr/windowBackground"
在drawable-mdpi文件夹下定义button_selector.xml
<span style="font-size:18px;"><?xml version="1.0" encoding="UTF-8"?>
< selector xmlns:android="http://schemas.android.com/apk/res/android">
< !-- 指定按钮按下时的图片 -->
<item android:state_pressed="true"
android:drawable="@drawable/start_down"
/>
< !-- 指定按钮松开时的图片 -->
<item android:state_pressed="false"
android:drawable="@drawable/start"
/>
< /selector></span>
在Layout中的main.xml
<span style="font-size:18px;"><Button
android:id="@+id/startButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button_selector" /></span>
EditText 和 TextView 参数
android:inputType
指定输入法的类型,int类型,可以用|选择多个。取值可以参考:android.text.InputType类。取值包括:text, textUri, phone,number,等。
android:imeOptions
指定输入法窗口中的回车键的功能,可选值为normal, actionNext,actionDone,actionSearch等。部分输入法对此的支持可能不够好。
android:imeOptions="actionNext"
android:nextFocusDown="@+id/minute"
上两条加一起才能跳转到minute。
转载自:http://www.360doc.com/content/12/0410/16/9085503_202516981.shtml