如何在Android中移除填充按钮周围? [英] How to remove padding around buttons in android?

查看:115
本文介绍了如何在Android中移除填充按钮周围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid应用程序,我有这样的布局:

In my android app, I have this layout:

<?xml version="1.0" encoding="utf-8" ?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical">

    <fragment
         android:id="@+id/map"
         android:layout_width="match_parent"
         android:layout_height="0dp" 
         android:layout_weight="1" 
         class="com.google.android.gms.maps.SupportMapFragment"/>

    <Button
        android:id="@+id/button_back"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:onClick="CloseActivity"
        android:padding="0dp"
        android:text="@+string/back" />

</LinearLayout>

而preVIEW和手机上的样子:

And the preview and on the phone looks like:

正如你可以在底部按钮看到,有一些填充那里。

As you can see on the bottom button, there is some padding there.

我怎样才能摆脱这一点,让按钮完全填满底部区域?

How can I get rid of that, and let the button fully fill the bottom area?

感谢

推荐答案

有关我的问题竟然是和了minHeight上了minWidth一些Android的主题。

For me the problem turned out to be minHeight and minWidth on some of the Android themes.

按钮元素中,添加:

<Button android:minHeight="0dp" android:minWidth="0dp" ...

或在您的按钮的风格:

Or in your button's style:

<item name="android:minHeight">0dp</item>
<item name="android:minWidth">0dp</item>

这篇关于如何在Android中移除填充按钮周围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆