【发布时间】:2014-08-08 12:52:18
【问题描述】:
我的按钮的部分 xml 代码。
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1.1"
android:orientation="vertical"
android:weightSum="4" >
<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="3"
android:textSize="25sp"
android:textStyle="bold" />
<Button
android:id="@+id/button6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="6"
android:textSize="25sp"
android:textStyle="bold" />
<Button
android:id="@+id/button9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="9"
android:textSize="25sp"
android:textStyle="bold" />
<Button
android:id="@+id/button12"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:drawableLeft="@drawable/bs2" />
</LinearLayout>
这里的问题是你看到退格箭头(左箭头)不适合按钮我试图使 .png 文件更大(尝试 48、64、80 和 120)也尝试了重力和 layout_gravity 没有没有得到任何结果。
所以基本上我希望箭头更宽,或者它应该在中间以获得良好的视觉效果。
所以我会喜欢任何有助于不弄乱布局的建议。
【问题讨论】:
-
您可以使用 ImageButton 代替 Button。
-
@SilentKiller 如果可能的话,我不希望这种情况发生,因为我的按钮不是自定义的,我有点用这个来制作我的主题。有什么办法可以使这项工作?
-
但在代码中您使用的是
Button默认值。显示您的主题代码。 -
@SilentKiller 是的,按钮是默认的。好吧,我不知何故没想到图像按钮有默认背景:/我仍然不能让按钮像其他按钮一样位于布局中,有什么想法吗?
-
提供您的箭头图像以及背景图像。'