安卓常用控件记录

1.TextView:

<TextView

             android:id="@+id/tv_date"

            android:layout_width="match_parent"

             android:layout_height="wrap_content"

             android:layout_margin="5dp"

            android:gravity="center"

            android:textColor="@color/light_blue"

            android:textSize="14sp" 

           android:textStyle="bold" //字体样式

//=================设置图标=======================

          android:drawableLeft="@drawable/alertwindows"
          android:drawablePadding="10dp"

//====================取消默认的系统空白填充==============

          android:includeFontPadding="false"

//=============文件添加阴影效果================

          android:shadowColor="#0f0"  //阴影颜色

         android:shadowDx="0"         //阴影水平偏移

         android:shadowDy="1"         //阴影垂直偏移

          android:shadowRadius="1"    //阴影的模糊半径

//=============走马灯效果===============

           android:ellipsize="marquee"

            android:focusable="true"

            android:focusableInTouchMode="true"

            android:marqueeRepeatLimit="marquee_forever"

            android:scrollHorizontally="true"

            android:singleLine="true"

 

 

/>

更换TextView的字体:

1.将字体文件放到res/assets/font/ DS-DIGI.TTF

 

2.在onCreate()方法中给控件设置setTypeface()字体。

private void initFont()

{

       Typeface localTypeface = Typeface.createFromAsset(getAssets(), "font/DS-DIGI.TTF");

      this.timingTime1_TextView.setTypeface(localTypeface);

      this.timingTime2_TextView.setTypeface(localTypeface);

      this.timingTime3_TextView.setTypeface(localTypeface);

}

2.EditText:

 <EditText
                        android:id="@+id/password"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="3dp"
                        android:hint="@string/wifi_password"

                        android:textColor="@color/brown"

                        android:textColorHint="@color/brown"
                        android:background="@drawable/bg_add_wifi_item"
                        android:textSize="24.0sp" 
                        android:paddingLeft="20dp"

 

//=====================点击收起虚拟键盘=========================
                        android:imeOptions="actionDone"
                        android:singleLine="true"

//=====================输入方式============================

                     android:inputType="textNoSuggestions"

                        />

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值