“...必须提供布局高度...”但它在我的风格资源中?
我在 2.1 及更高版本上有一个可以运行的应用程序,直到我尝试使用样式主题清理我的初始布局。现在,应用程序甚至不会以指向布局中我的第一个 EditText 视图的“您必须提供布局高度属性”失败消息启动。
为什么我不能将在每个 EditText 上正常工作的“layout_height=30dp”移动到 ... 项目名称=“android:layout_height”>30dp< ...通过我的主题引用的风格?
事实上,我像这样抽象出来的所有其他风格效果都工作得很好。
[得知这一定是对 LinearLayout 的某种样式覆盖,而不是对 EditText 的覆盖,我不会感到惊讶。或者它必须是视图的样式项,而不是小部件。我不知道。]
想法?有人吗?什么是显而易见的事情却被忽视了? 预先感谢您的任何建议!
AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
<application android:label="xxx"
android:icon="@drawable/xxx" >
<activity android:name="DataEntry"
android:label="xxx"
android:theme="@style/xxx_theme.A" >
...
xxx_theme.A.xml
<style name="xxx_theme" parent="@android:Theme" >
<item name="android:windowNoTitle">true</item>
</style>
<style name="xxx_theme.A" >
<item name="android:textViewStyle">@style/xxx_TextView_widget</item>
<item name="android:editTextStyle">@style/xxx_EditText_widget</item>
<item name="android:checkboxStyle">@style/xxx_CheckBox_widget</item>
<item name="android:radioButtonStyle">@style/xxx_Radio_widget</item>
</style>
<style name="xxx_EditText_widget" parent="@android:style/Widget.EditText" >
<item name="android:textSize">9dp</item>
<item name="android:layout_height">30dp</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingTop">1dp</item>
<item name="android:paddingBottom">1dp</item>
<item name="android:textColorHint">@color/texthint</item>
<item name="android:singleLine">true</item>
<item name="android:selectAllOnFocus">true</item>
<item name="android:inputType">textNoSuggestions</item>
</style>
...
I had a working app on 2.1 and above until I tried to cleanup my initial layout with a theme of styles. Now the app won't even start with the "You must supply a layout_height attribute" failure message pointing to my first EditText View in the layout.
Why can I not move the 'layout_height=30dp" that was working fine on every EditText into an
... item name="android:layout_height">30dp< ... in a style referred to via my theme?
Virtually all my other style effects I abstracted out like this are working just fine.
[It won't surprise me to learn this must be some styled override to the LinearLayout, not the EditText's. OR that its got to be a styled item for the View, not the Widget. I don't know.]
Ideas? Anyone? What is the obvious thing overlooked?
THANKS in advance for any suggestions!
AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
<application android:label="xxx"
android:icon="@drawable/xxx" >
<activity android:name="DataEntry"
android:label="xxx"
android:theme="@style/xxx_theme.A" >
...
xxx_theme.A.xml
<style name="xxx_theme" parent="@android:Theme" >
<item name="android:windowNoTitle">true</item>
</style>
<style name="xxx_theme.A" >
<item name="android:textViewStyle">@style/xxx_TextView_widget</item>
<item name="android:editTextStyle">@style/xxx_EditText_widget</item>
<item name="android:checkboxStyle">@style/xxx_CheckBox_widget</item>
<item name="android:radioButtonStyle">@style/xxx_Radio_widget</item>
</style>
<style name="xxx_EditText_widget" parent="@android:style/Widget.EditText" >
<item name="android:textSize">9dp</item>
<item name="android:layout_height">30dp</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingTop">1dp</item>
<item name="android:paddingBottom">1dp</item>
<item name="android:textColorHint">@color/texthint</item>
<item name="android:singleLine">true</item>
<item name="android:selectAllOnFocus">true</item>
<item name="android:inputType">textNoSuggestions</item>
</style>
...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你有
- 30dp
;
但您的样式中没有
android:layout_width
。你两者都需要。
You have
<item name="android:layout_height">30dp</item>
but no
android:layout_width
in your style.You need both.
看看我的答案
Check out my answer here. It most likely has to do with a missing attribute in your
styles.xml
file.