如何删除Android CheckBox周围的填充 [英] How to remove padding around Android CheckBox

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

问题描述

我需要在我的imageview的右上角放置支票.但是,当我这样做时,我注意到我的复选框周围有默认边距.有办法删除吗?

I need to put check to the right hand top corner of my imageview. But when I do this I noticed a default margin around my checkbox. Is there a way to remove this??

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

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" >

        <ImageView
            android:id="@+id/thumbImage"
            android:layout_width="100dp"
            android:layout_height="132dp"
            android:layout_gravity="center" />
    </FrameLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:background="#ff0000"
        android:gravity="center" >

        <CheckBox
            android:id="@+id/itemCheckBox"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_gravity="center"
            android:button="@drawable/checkbox_background"
            android:paddingLeft="0dp"
            android:paddingTop="0dp" />

    </LinearLayout>

</RelativeLayout>

推荐答案

您可以使用负边距.

android:layout_marginTop = "-5dp"
android:layout_marginRight = "-5dp"

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

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