Android 简单 控件

  • xml 布局文件下
专门用来点击 的控件(按钮)

<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"
  />

    设置输入框提示 android:hint="请输入用户名"
视图的控件
<View

       android:layout_width="10dp"
       android:layout_height="10dp"
/>
滑动视图 ScrollView

<ScrollView

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

 </ScrollView>

当视图内容超出屏幕时,需要(上下)滑动
页面视图的滑动 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"
/>
圆形的进度条ProgressBar

 <ProgressBar

        android:layout_width="50dp"
        android:layout_height="50dp" 
/>
  • 创建简单图形 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  (默认值) 根据加载图片的屏幕大小动态进行缩放 
    值为 clamp  当图片大于加载的屏幕或者是控件的大小的时候,会对其进行 裁剪(从左上角开始)
                当图片小于加载 的屏幕或者是控件的大小的时候 ,其他空白的地方会以图片边缘的颜色来填充
    值为 repeat 图片会重复填充界面
    值为 mirror 图片会以镜像的形式重复填充界面 

android:antialias="true" 设置加载模式为抗锯齿
android:dither="true"   设置加载模式为 防抖动
shape 用来画图

<shape          xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"            画圆

android:shape="line"            画直线

android:shape="rectangle"       画矩形

android:shape="ring"            画圆环
>
    <!-- 设置默认的 宽与 高  -->
    <size android:width="10dp" android:height="10dp"/>
    <!-- 设置颜色  -->
    <solid android:color="#333333"/>

</shape>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值