" ...必须提供layout_height ..."但它在我的风格的资源? [英] "...must supply a layout_height..." but its in my style resources?

查看:157
本文介绍了" ...必须提供layout_height ..."但它在我的风格的资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对2.1工作程序及以上的,直到我试图清理我的初始布局与风格主题。现在,应用程序甚至不会开始与你必须提供一个layout_height属性失败消息指着我第一次的EditText视图中的布局。

为什么我不能移动layout_height = 30dp这是工作的罚款对每一个的EditText成 ...项目名称=机器人:layout_height> 30dp< ...在风格通过我的主题称为?

事实上,所有我的其他样式效果我抽象出来这样的工作就好了。

[这不会让我感到吃惊学习这一定是有风格的覆盖到的LinearLayout,不是的EditText的。或者说,它必须是一个风格的项目的视图,而不是小工具。不知道]

想法?有人吗?什么是显而易见的事情忽略了? 在此先感谢您的任何建议!

AndroidManifest.xml中:

 <舱单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
...
<应用机器人:标签=XXX
    机器人:图标=@可绘制/ XXX>

<活动机器人:名称=DataEntry
    机器人:标签=XXX
    机器人:主题=@风格/ xxx_theme.A>
...
 

xxx_theme.A.xml

 <样式名称=xxx_theme父=@安卓主题>
  <项目名称=机器人:windowNoTitle>真< /项目>
< /风格>

<样式名称=xxx_theme.A>
  <项目名称=机器人:textViewStyle> @风格/ xxx_TextView_widget< /项目>
  <项目名称=机器人:editTextStyle> @风格/ xxx_EditText_widget< /项目>
  <项目名称=机器人:checkboxStyle> @风格/ xxx_CheckBox_widget< /项目>
  <项目名称=机器人:radioButtonStyle> @风格/ xxx_Radio_widget< /项目>
< /风格>

<样式名称=xxx_EditText_widget父=@安卓风格/ Widget.EditText>
  <项目名称=机器人:TEXTSIZE> 9dp< /项目>
  <项目名称=机器人:layout_height> 30dp< /项目>
  <项目名称=机器人:以下属性来> 8DP< /项目>
  <项目名称=机器人:paddingTop> 1DP< /项目>
  <项目名称=机器人:paddingBottom会> 1DP< /项目>
  <项目名称=机器人:textColorHint> @色/ texthint< /项目>
  <项目名称=机器人:单线>真< /项目>
  <项目名称=机器人:selectAllOnFocus>真< /项目>
  <项目名称=机器人:inputType> textNoSuggestions< /项目>
< /风格>
...
 

解决方案

您有   <项目名称=机器人:layout_height> 30dp< /项目> 但没有 Android的:layout_width在你的风格

您需要两个。

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. Dunno]

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>
...

解决方案

You have <item name="android:layout_height">30dp</item> but no android:layout_width in your style.

You need both.

这篇关于&QUOT; ...必须提供layout_height ...&QUOT;但它在我的风格的资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆