设置圆角搜索框

来源:互联网 发布:淘宝扑克牌 编辑:程序博客网 时间:2024/05/16 06:33

设置TextView的中划线

text.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
设置圆角边框

<?xml version="1.0" encoding="utf-8"?><LinearLayout    xmlns:android="http://schemas.android.com/apk/res/android"    android:orientation="horizontal"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:gravity="center"    >    <LinearLayout        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:background="@drawable/yj"        android:orientation="horizontal"        android:gravity="center"        >        <ImageView            android:id="@+id/imageView"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:src="@mipmap/ic_launcher" />        <EditText            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:background="@null"            android:hint="搜索" />    </LinearLayout></LinearLayout>
在drawable里设置一个xml
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android">设置边框颜色和宽度    
<stroke        android:color="#000" android:width="3dp"        />设置圆角大小        <corners            android:bottomLeftRadius="20dp"            android:topLeftRadius="20dp"            android:topRightRadius="20dp"            android:bottomRightRadius="20dp"            ></corners>设置内容与边框的距离    <padding        android:bottom="10dp"        android:right="50dp"        android:left="10dp"        android:top="10dp"        ></padding></shape>


原创粉丝点击