Android基礎UI控制項

2021-08-04 09:07:43 字數 3239 閱讀 6271

這只是常用的幾個控制項,還有第三方控制項沒有一一列出。

注意必須給控制項設定寬高。

button

android:id="@+id/button"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="按鈕"/>

textview

android:id="@+id/textview"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="文字"

android:textsize="25sp"

android:textcolor="@color/coloraccent"/>

edittext

android:id="@+id/edittext"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:hint="輸入框"/>

checkbox

android:id="@+id/checkbox"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="多選框"/>

radiogroup,radiobutton

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="horizontal">

android:layout_weight="1"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:button="@null"

android:text="按鈕1"/>

android:layout_weight="1"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:button="@null"

android:text="按鈕2"/>

android:layout_weight="1"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:button="@null"

android:text="按鈕3"/>

radiogroup>

imageview

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="@mipmap/ic_launcher"/>

progressbar

水平進度條 style=」?android:attr/progressbarstylehorizontal」

2.乙個大圓形樣式 style=」?android:attr/progressbarstylelarge」

3.小圓形樣式 style=」?android:attr/progressbarstylesmalltitle」

progressbar的詳細使用

android:layout_width="match_parent"

android:layout_height="wrap_content"

style="?android:attr/progressbarstylehorizontal"

/>

seekbar拖動條

設定拖動條的條形形狀

android:progressdrawable=」@mipmap/ic_launcher」

設定拖動條的拖動按鈕

android:thumb=」@mipmap/ic_launcher」

詳細使用解說

android:layout_width="match_parent"

android:layout_height="wrap_content"

/>

listview條目

android:id="@+id/listview"

android:layout_width="match_parent"

android:layout_height="wrap_content"/>

gridview九宮格

android:id="@+id/gridview"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:numcolumns="3"/>

viewpager

.support

.v4.view

.viewpager

android:layout_width="match_parent"

android:layout_height="match_parent"/>

framelayout碎片

android:layout_width="match_parent"

android:layout_height="match_parent"/>

android基礎控制項

textview 顯示文字 imageview 顯示 edittext 輸入框,可編輯,可設定軟鍵盤方式 button 按鈕,可附帶 checkbox 核取方塊 radiobutton 單選按鈕 文字控制項 textview edittext 按鈕控制項 button imagebutton 狀態開...

42 UI基礎控制項

uiview的常見屬性 property nonatomic,readonly uiview superview 獲得自己的父控制項物件 property nonatomic,readonly,copy nsarray subviews 獲得自己的所有子控制項物件 property nonatomi...

android常用UI控制項的使用例子

之前有幾個好朋友說最近android很火,很想學習下android,在他們的要求下,我給他們講解了android的一些基礎知識,帶他們進入android的大門,以下是講解課程中的第二課,常用ui控制項的使用,第一課主要是android的一些簡單介紹和環境的搭建,這個可以參考我之前的環境搭建的文章,這...