2015-03-19 88 views
1

我使用Widget.AppCompat.SearchView拿到,看起来搜索栏,并在此article现在获得正确的搜索栏

解释,但我想要的东西,更喜欢这个,但我自己的颜色可以调整方案。 enter image description here

我是否需要使用其他小部件?如果是这样的话?

回答

2

我认为你需要Theme.AppCompact.Light为明亮的颜色。

res/values/themes.xml

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <!-- the theme applied to the application or activity --> 
    <style name="CustomActionBarTheme" 
      parent="@android:style/Theme.Holo.Light.DarkActionBar"> 
     <item name="android:actionBarStyle">@style/MyActionBar</item> 
    </style> 

    <!-- ActionBar styles --> 
    <style name="MyActionBar" 
      parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse"> 
     <item name="android:background">@drawable/actionbar_background</item> 
    </style> 
</resources> 

或此为文字的变化颜色(搜索文本); 在:res/values/themes.xml

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <!-- the theme applied to the application or activity --> 
    <style name="CustomActionBarTheme" 
      parent="@style/Theme.Holo"> 
     <item name="android:actionBarStyle">@style/MyActionBar</item> 
     <item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item> 
     <item name="android:actionMenuTextColor">@color/actionbar_text</item> 
    </style> 

    <!-- ActionBar styles --> 
    <style name="MyActionBar" 
      parent="@style/Widget.Holo.ActionBar"> 
     <item name="android:titleTextStyle">@style/MyActionBarTitleText</item> 
    </style> 

    <!-- ActionBar title text --> 
    <style name="MyActionBarTitleText" 
      parent="@style/TextAppearance.Holo.Widget.ActionBar.Title"> 
     <item name="android:textColor">@color/actionbar_text</item> 
    </style> 

    <!-- ActionBar tabs text styles --> 
    <style name="MyActionBarTabText" 
      parent="@style/Widget.Holo.ActionBar.TabText"> 
     <item name="android:textColor">@color/actionbar_text</item> 
    </style> 
</resources> 

如果你能翻译波斯语,使用此:

Customization Searchbar ,我也建议你阅读本:

Customize the Android search view widget

希望这有助于你。

+0

你用最新的AppCompat v21 +试过这个吗? – 2015-03-19 13:16:36

+0

最后一个链接提到,为了得到我想要的东西,我将不得不破解它,以及所有相关的风险。所以不知道这是不是他想要的,但至少现在我可以与他分享这些信息,如果他想继续。感谢您回答问题。 – 2015-03-19 13:19:28

+0

@RekijanKileren这对你有用吗? – 2015-03-19 13:25:45