3
我经常不得不手动布局参数,以我的按钮如何设置按钮样式的默认布局参数?
<Button
android:id="@+id/signIn"
android:layout_above="@+id/forgotPassword"
android:text="@string/button_sign_in"
<!-- Repetitive part -->
android:layout_marginLeft="@dimen/button_margin_left"
android:layout_marginRight="@dimen/button_margin_right"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
我styles.xml
<style name="myButton" parent="android:style/Widget.Button">
<item name="android:textColor">@color/button_textColor</item>
<item name="android:background">@drawable/button_background</item>
<item name="android:textSize">@dimen/button_textSize</item>
<item name="android:padding">@dimen/button_padding</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_marginLeft">@dimen/button_margin_left</item>
<item name="android:layout_marginRight">@dimen/button_margin_right</item>
</style>
但是最后三个值似乎都没有影响! 如果我不能在样式xml中设置它,我可以设置eclipse来更改使用图形布局时创建的默认值吗?
有你'设置样式=“myButton的”'? –
@Bicou yerp,其他值:textSize,textColor,背景和填充都是继承的 – Moak