width, layout
I used a style file to set a unique style for same layouts,
Style:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- User form layout style -->
<style name="UserFormLayoutRow">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:orientation">horizontal</item>
<item name="android:paddingBottom">@dimen/padding_small</item>
</style>
</resources >
//In layout file
<LinearLayout
style="@style/UserFormLayoutRow" >
//contents
</LinearLayout>
Error:(design time)
Error at run time:
06-13 05:58:14.506: E/AndroidRuntime(936): Caused by: java.lang.RuntimeException: Binary XML file line #105: You must supply a layout_width attribute.
Where i am going wrong? TIA
EDIT I checked for your scenario. It appears that layout_width and layout_height must be given defined under layout. If you do not want to mention them in xml, then mention it in style.xml and use it for your view.
Even i had this same problem, the way i solved is just provide wrap_content to both height and width in the layout xml file . Then override whatever height and width you want in the style xml file , so now you need not change the value again in layout xml file. At last just add the style attribute to the corresponding view.
链接地址: http://www.djcxy.com/p/14036.html上一篇: Eclipse如何编译这个Java代码,但不是Ant?
下一篇: 宽度,布局