开发者

Trouble padding

开发者 https://www.devze.com 2023-01-11 04:29 出处:网络
I have a horizontal LinearLayout.This LinearLayout has a checkbox next to another LinearLayout.The layout width/height of the checkbox is wrap_content, whereas the inner LinearLayout is fill_parent/wr

I have a horizontal LinearLayout. This LinearLayout has a checkbox next to another LinearLayout. The layout width/height of the checkbox is wrap_content, whereas the inner LinearLayout is fill_parent/wrap_content. The layout_weight of the inner LinearLayout is set to 1.

I've tried to add some android:padding around the checkbox to give some space around it, but no padding is give开发者_开发百科n. I've also tried android:paddingLeft/Right/etc. How do I get some padding around my checkbox?

Note: I have an inner LinearLayout because I will be adding more 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>


Try setting layout_marginLeft property of the second layout

0

精彩评论

暂无评论...
验证码 换一张
取 消