【问题标题】:Different border width for button按钮的不同边框宽度
【发布时间】:2011-08-09 09:57:17
【问题描述】:

如何为 android 上的按钮设置不同的宽度?像顶部和底部是 2dp 但左右是 4dp?谢谢。

更新:

如果我的问题不清楚,我深表歉意。它不是边距或填充。但我想自定义宽度,如css中的border-top或border-left。安卓可以吗?

【问题讨论】:

  • 你的问题不清楚..如何将顶部和底部设置为 2dp..你不能那样设置宽度......它可以是高度和宽度..
  • 你的意思是填充还是边距?
  • @ayubin n ntc,我的问题已更新。谢谢。

标签: android android-button


【解决方案1】:

你的问题不清楚。你看起来像下面这样吗?

<Button 
android:text="Button"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp" 
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:id="@+id/button1" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content">
</Button>

【讨论】:

    猜你喜欢
    • 2013-05-31
    • 1970-01-01
    • 2015-05-09
    • 2013-06-16
    • 2023-01-30
    • 1970-01-01
    • 1970-01-01
    • 2016-08-11
    • 1970-01-01
    相关资源
    最近更新 更多