【问题标题】:expandable list view checkbox smaller可扩展列表视图复选框更小
【发布时间】:2015-02-26 22:49:51
【问题描述】:

这里有一个可展开的列表视图

现在我在下面的孩子中放了一个复选框

我的 childview 变大了 - 为什么以及如何将其设置得更小?

    <?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="wrap_content"
    android:padding="10dp"
android:background="@drawable/mb">
    <TextView
        android:id="@+id/list"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:paddingLeft="23dp"
        android:textSize="18dp"
        android:textStyle="bold"
        android:textColor="#000000"
        />

    <CheckBox
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"

        android:id="@+id/checkBox"
        android:layout_centerVertical="true"

        android:layout_alignParentRight="true"
        />

</RelativeLayout>

【问题讨论】:

  • 这里,检查一下:stackoverflow.com/questions/2151241/… 我认为诀窍是使用wrap_content 作为复选框的布局宽度和高度。
  • 直到现在都没有任何效果 - 一个自定义复选框嗯,也许还有另一种简单的方法
  • 你使用普通的复选框对吗?
  • 是的,我愿意......
  • 尝试在layout_heightlayout_width 上调整dp 的大小,如下所示:`android:layout_width="1dp"` 或任何你想要的大小。

标签: android checkbox expandablelistview


【解决方案1】:

更改复选框(或其他任何内容)的layout_heightlayout_width 上的dp 以获得您需要的大小。例如:

<Checkbox
 android:layout_width="1dp"
 android:layout_height="1dp"
 android:id="@+id/checkBox"/>

在您要重新调整大小的项目中。

另一种选择是使用自定义复选框,更多信息在这里:Android: How to change CheckBox size?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多