麻烦填充

我有一个水平的LinearLayout。 这个LinearLayout在另一个LinearLayout旁边有一个复选框。 复选框的布局宽度/高度是wrap_content,而内部LinearLayout是fill_parent / wrap_content。 内部LinearLayout的layout_weight设置为1。

我试图在复选框周围添加一些android:padding以提供一些空间,但没有填充。 我也试过android:paddingLeft / Right / etc。 如何在我的复选框周围填充一些填充?

注意:我有一个内部的LinearLayout,因为我将添加更多的TextViews

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="?android:attr/listPreferredItemHeight">
    <CheckBox
        android:id="@+id/mycheck"
        android:text=""
        android:layout_width="30dip"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:focusable="false"
        android:background="@drawable/checkbox_background"
        android:button="@drawable/checkbox"
    />
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_weight="1"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/mytext"
            android:layout_width="fill_parent"
            android:layout_weight="1"
            android:gravity="center_vertical"
            android:layout_height="wrap_content"
            android:lines="1"
            android:textColor="@color/white"
            android:textSize="10sp"
            android:textStyle="italic"
        />
    </LinearLayout>
</LinearLayout>

尝试设置第二个布局的layout_marginLeft属性

链接地址: http://www.djcxy.com/p/93237.html

上一篇: Trouble padding

下一篇: Why do ListView items not grow to wrap their content?