Android 搜索框

1.首先布局文件

<android.support.v7.widget.SearchView
            android:layout_width="0dp"
            android:layout_height="50dp"
            android:layout_weight="8"
            android:background="@drawable/shape"/>
           

2.其次,在drawable下边创建一个shape

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid
        android:color="#e1dcdc" />
    <stroke
        android:width="1dp"
        android:color="#181616"/>
    <corners
        android:radius="50dp"
        android:topLeftRadius="45dp"
        android:topRightRadius="45dp"
        android:bottomLeftRadius="45dp"
        android:bottomRightRadius="45dp"/>
</shape>

猜你喜欢

转载自blog.csdn.net/qq_42785994/article/details/84166085
今日推荐