you*_*_08 4 android android-view searchview android-search android-styles
我想更改searchview的边框颜色.现在它变得透明了.我尝试给它造型但没有任何效果.
SearchView.xml
<LinearLayout
android:id="@+id/linear1"
android:background="@android:color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<android.support.v7.widget.SearchView
android:layout_width="300dp"
android:layout_height="wrap_content"
android:id="@+id/searchView"
android:background="@android:color/white"
android:layout_marginTop="10dp"
style="@style/CitySearchView"
android:layout_weight="0.9"
android:layout_marginLeft="10dp"/>
Run Code Online (Sandbox Code Playgroud)
风格= "@风格/ CitySearchView"
<style name="CitySearchView" parent="Widget.AppCompat.Light.SearchView">
<item name="searchIcon">@drawable/blue_search_bar</item>
<item name="colorControlActivated">@color/labelColorHighligh</item>
<item name="colorControlNormal">@color/backgroud_user</item>
<item name="queryBackground">@color/labelColorHighligh</item>
</style>
Run Code Online (Sandbox Code Playgroud)
style.xml
<LinearLayout
android:id="@+id/linear1"
android:background="@android:color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<android.support.v7.widget.SearchView
android:layout_width="300dp"
android:layout_height="wrap_content"
android:id="@+id/searchView"
android:background="@android:color/white"
android:layout_marginTop="10dp"
style="@style/CitySearchView"
android:layout_weight="0.9"
android:layout_marginLeft="10dp"/>
Run Code Online (Sandbox Code Playgroud)
小智 8
1)创建文件夹drawable
2)在create background.xml中绘制
3)background.xmal在写这段代码
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="12dp"
android:shape="rectangle" >
<solid android:color="#FFFFFF" />
<stroke
android:width="0.3dp"
android:color="#797979" />
</shape>
Run Code Online (Sandbox Code Playgroud)
更改SearchView teg
<android.support.v7.widget.SearchView
android:background="@drawable/background"
android:id="@+id/searchView"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_width="300dp" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6115 次 |
| 最近记录: |