如何让我的Android按钮更小?

时间:2017-07-11 13:42:05

标签: android

这是我目前的代码。

<Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Weather"
        android:textColor="@color/colorDark"
        style="@style/XM.ActionBar.ButtonSecondary"
        android:drawableTop="@mipmap/ic_weather_sunny" />

如何使整个按钮尺寸变小?它在LinearLayout中。

由于 凯文

3 个答案:

答案 0 :(得分:2)

如果您想要更小的按钮尺寸,可以手动设置宽度和高度,而不是使用wrap_content。 但这样做可能会使您的按钮太小而无法包含文本。所以你可能想控制字体大小

<Button android:layout_width="100dp"
    android:layout_height="100dp"
    android:text="Weather"
    android:textSize="10sp"
    android:textColor="@color/colorDark"
    style="@style/XM.ActionBar.ButtonSecondary"
    android:drawableTop="@mipmap/ic_weather_sunny"/>

编辑:textSize to sp感谢@MinnuKaAnae

答案 1 :(得分:0)

根据您的要求更改宽度和高度

  <Button
    android:layout_width="80dp"
    android:layout_height="40dp"
    android:text="Weather"
    android:textColor="@color/colorDark"
    style="@style/XM.ActionBar.ButtonSecondary"
    android:drawableTop="@mipmap/ic_weather_sunny" />

答案 2 :(得分:0)

尝试将宽度和高度设置为每个40dp。 如果它不起作用,请删除应用的主题:D

相关问题