原创 ToggleButton控件的使用

本次主要介紹一下ToggleButton控件的使用,ToggleButton擁有兩種不同的狀態–On和Off. <ToggleButton android:id="@+id/toggleButton1"

原创 線性佈局LinearLayout常用屬性

LinearLayout常用屬性 android:orientation —-該屬性決定子類控件的排布方式,包括垂直(vertical)和水平(horizontal) android:gravity —-該屬性決定子類的位置 1. ce

原创 設置Button監聽事件的三種方式

設置Button監聽事件的三種方式 三種Button監聽事件設置方法 匿名內部類 外部類 接口方式 匿名內部類 直接創建匿名內部類。 loginButton.setOnClickListener(new OnClick

原创 相對佈局RelativeLayout的子控件屬性和操作

RelativeLayout是相對佈局控件,它包含的子控件將以控件之間的相對位置或者子類控件相對父類容器的位置方式排列。 子類控件常用屬性 android:layout_alignParentLeft -子類控件相對當前父類容器靠左

原创 TextView跑馬燈效果的實現

當Layout中只有一個TextView需要實現跑馬燈效果時,操作如下。 在Layout的TextView配置文件中增加 android:ellipsize="marquee" android:focu

原创 AutoCompleteTextView和MultiAutoCompleteTextView的使用

AutoCompleteTextView 在Layout文件中添加AutoCompleteTextView控件後,在xml文件中添加屬性android:completionThreshold,表示在輸入多少個字符以後進行字符串的匹配,如下

原创 RadioGrop和RadioButton

控件屬性 <RadioGroup android:orientation="horizontal" android:id="@+id/radioGroup1" android:lay

原创 CheckBox控件

控件屬性 <CheckBox android:id="@+id/checkBox1" android:layout_width="wrap_content" android:layout_h