簡單 控件

  • xml 布局文件下
專門用來點(diǎn)擊 的控件(按鈕)

<Button

        android:layout_width="100dp"
        android:layout_height="50dp"
 />
專門用來顯示文本的控件 TextView

 <TextView

      android:layout_width="80dp"
      android:layout_height="50dp" 
 />
專門用來編輯文本的控件 EditText

 <EditText

        android:layout_width="191dp"
        android:layout_height="50dp"
  />

    設(shè)置輸入框提示 android:hint="請輸入用戶名"
視圖的控件
<View

       android:layout_width="10dp"
       android:layout_height="10dp"
/>
滑動視圖 ScrollView

<ScrollView

    android:layout_width="match_parent"
    android:layout_height="match_parent" 
>

 </ScrollView>

當(dāng)視圖內(nèi)容超出屏幕時,需要(上下)滑動
頁面視圖的滑動 ViewPager

 <android.support.v4.view.ViewPager

        android:layout_width="match_parent"
        android:layout_height="match_parent"
/>
用來顯示加載圖片ImageView
通過 src 來用圖片

<ImageView

      android:src="@mipmap/picture"
      android:layout_width="50dp"
      android:layout_height="50dp" 
/>
列表形式的視圖ListView

<ListView

        android:layout_width="match_parent"
        android:layout_height="match_parent"
 />
選擇框 
 <CheckBox

      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
/>
圓形的進(jìn)度條ProgressBar

 <ProgressBar

        android:layout_width="50dp"
        android:layout_height="50dp" 
/>
  • 創(chuàng)建簡單圖形 drawable 目錄下
在android中描述 形容圖片  是通過  Bitmap這個類來操作
Bitmap 加載 處理圖片

<bitmap     xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@mipmap/welcome_bg"
    android:tileMode="disabled"
    android:antialias="true"
    android:dither="true"
    >

</bitmap>


src 是用來加載 圖片

tileMode 是加載的方式 
    值為 disabled  (默認(rèn)值) 根據(jù)加載圖片的屏幕大小動態(tài)進(jìn)行縮放 
    值為 clamp  當(dāng)圖片大于加載的屏幕或者是控件的大小的時候,會對其進(jìn)行 裁剪(從左上角開始)
                當(dāng)圖片小于加載 的屏幕或者是控件的大小的時候 ,其他空白的地方會以圖片邊緣的顏色來填充
    值為 repeat 圖片會重復(fù)填充界面
    值為 mirror 圖片會以鏡像的形式重復(fù)填充界面 

android:antialias="true" 設(shè)置加載模式為抗鋸齒
android:dither="true"   設(shè)置加載模式為 防抖動
shape 用來畫圖

<shape          xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"            畫圓

android:shape="line"            畫直線

android:shape="rectangle"       畫矩形

android:shape="ring"            畫圓環(huán)
>
    <!-- 設(shè)置默認(rèn)的 寬與 高  -->
    <size android:width="10dp" android:height="10dp"/>
    <!-- 設(shè)置顏色  -->
    <solid android:color="#333333"/>

</shape>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容