安卓顶部圆角搜索框、搜索图标

这里写图片描述

//values中配置去标题栏
 <style name="Platform.AppCompat" parent="android:Theme">
        <item name="android:windowNoTitle">trueitem>
        style>
//Layout布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
            android:id="@+id/layout_home_pager_bar"
              android:layout_height="?attr/actionBarSize"
              android:background="@color/color_ff9800"
              android:gravity="center_vertical"
              android:orientation="horizontal">


    <TextView
        android:id="@+id/edt_search"
        android:layout_width="0.0dp"
        android:layout_height="31dp"
        android:layout_marginLeft="@dimen/horizontal_dimen_12dp"
        android:layout_weight="1"
        android:drawablePadding="@dimen/horizontal_dimen_10dp"
        android:background="@drawable/style_home_pager_toolbar_search_view"
        android:drawableLeft="@mipmap/img_hp_search"
        android:gravity="center_vertical"
        android:hint="这里是一些字体"
        android:lines="1"
        android:paddingLeft="@dimen/horizontal_dimen_12dp"
        android:textColor="@color/white"
        android:textColorHint="@color/color_ffdebd"/>

    <ImageView
        android:id="@+id/btn_notice_message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@android:color/transparent"
        android:paddingLeft="@dimen/horizontal_dimen_12dp"
        android:paddingRight="@dimen/horizontal_dimen_12dp"
        android:src="@mipmap/img_hp_notice_message"/>


LinearLayout>
**//android:background="@drawable/style_home_pager_toolbar_search_view"中的布局**


<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:radius="@dimen/horizontal_dimen_20dp"/>
            <solid android:color="@color/color_FFa726" />
        shape>

    item>
layer-list>

你可能感兴趣的:(安卓,搜索框)