zoukankan      html  css  js  c++  java
  • android EditText实现圆弧背景

    一.给EditText添加背景,并且4角圆弧

    对应的xml 以及样式如下:

    <EditText
                    android:id="@+id/o_item_num"
                    style="@style/ValueTextStyle"
                    android:hint="请输入服务次数"
                    android:layout_height="40.0dip"
                    android:inputType="number"
                    android:singleLine="true"
                    android:text="1" />
    <style name="ValueTextStyle">
            <item name="android:textSize">@dimen/txt_m</item>
            <item name="android:background">@drawable/edit_bg_selector</item>
            <item name="android:layout_width">fill_parent</item>
            <item name="android:layout_height">wrap_content</item>
            <item name="android:layout_marginLeft">15.0dip</item>
            <item name="android:layout_marginTop">10.0dip</item>
            <item name="android:layout_marginRight">15.0dip</item>
            <item name="android:layout_marginBottom">10.0dip</item>
            <item name="android:layout_centerVertical">true</item>
        </style>
    <?xml version="1.0" encoding="utf-8"?>
    <selector
      xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:state_enabled="false" android:drawable="@drawable/edit_text_disable" />
        <item android:state_focused="true" android:drawable="@drawable/edit_text_focused" />
        <item android:state_pressed="true" android:drawable="@drawable/edit_text_focused" />
        <item android:drawable="@drawable/edit_text" />
    </selector>

    当然还有一种方式是定义 圆弧 shape来实现 

  • 相关阅读:
    jQuery自定义漂亮的下拉框插件8种效果演示
    Select-or-Die演示11种美化下拉框select方法
    jQuery超酷下拉插件6种效果演示
    jQuery10种不同动画效果的响应式全屏遮罩层
    jQuery Wheel 环形菜单插件5种效果演示
    js显示隐藏
    js关于函数调用
    php入门
    jquery幻灯片
    Mysql命令大全
  • 原文地址:https://www.cnblogs.com/android-zcq/p/5437531.html
Copyright © 2011-2022 走看看