我最近一直在使用这些神奇的图书馆:ActionBarSherlock
,HoloEverywhere
和SlidingMenu
。
然后我偶然发现了这个奇怪的问题: 当我在View中添加EditText时,HoloEverywhere主题正常工作。但是当我向ActionBarSherlock添加一个EditText时,HoloEverywhere主题并没有覆盖默认主题。
这就是我将EditText添加到ActionBarSherlock的方法:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<EditText
android:id="@+id/collapsibleEditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/widget_searchview_title"
android:imeOptions="actionSearch"
android:inputType="text" android:paddingRight="35dip" />
<Button
android:id="@+id/clearButton"
android:layout_width="30dip"
android:layout_height="30dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dip"
android:background="@drawable/navigation_cancel" />
</RelativeLayout>
和
menu.add("Search")
.setIcon(R.drawable.ic_action_search)
.setActionView(R.layout.collapsible_edittext)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS |
MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
这就像在模拟器上运行一样(因为我没有蜂窝前设备):
这是一个已知问题吗?我确信我在实施过程中搞砸了。谁能指导我完成这个问题?感谢。
答案 0 :(得分:0)
最后我决定HoloEverywhere对我的应用来说太沉重了,并决定手动包含并应用我需要使用的样式,这解决了我遇到的问题。
此解决方案基于此SO帖子: https://stackoverflow.com/a/10903421/690917