在我的一项 Activity 中,我的 EditText View 过去看起来像这样
但是现在他们是这个样子
我需要帮助将其改回:从矩形改成下划线。
背景
因为我需要创建一个自定义的 ActionBar,所以我不得不更改相关 Activity 的主题,YesterdayActivity
,使用以下内容
风格:
<style name="CustomWindowTitleBackground">
<item name="android:background">#323331</item>
</style>
<style name="CustomTheme" parent="android:Theme">
<item name="android:windowTitleSize">40dip</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
</style>
list :
<activity
android:name="com.example.YesterdayActivity"
android:theme="@style/CustomTheme">
</activity>
创建时:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.activity_yesterday);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.yesterday_title_bar);
…
}
最佳答案
像这样更改您的自定义主题
<style name="CustomTheme" parent="android:Theme.Holo.NoActionBar">
因为你没有使用旧的 android 主题而不是 HoLo
有那种 editTextView
在较新版本的 Android 中,只要选择 Holo 主题,框架就会使用 Window.FEATURE_ACTION_BAR
功能。每当应用程序调用 setFeatureInt(Window.FEATURE_CUSTOM_TITLE)
并且 FEATURE_ACTION_BAR
已设置时,框架就会抛出异常。
它崩溃是因为 Holo 默认使用 ActionBar。修复很简单。使用 Holo 时关闭 ActionBar
关于android - 将 android EditText 样式从矩形边框更改为下划线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17607173/