相关疑难解决方法(0)

android动态添加复选框

以下是我的布局xmls.现在我们在布局中有一个有限数量(七个)的复选框(listitem.xml).我们将它添加到线性布局中.

main.xml中

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

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="21dp"
        android:layout_marginTop="38dp" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/linearLayout1"
            android:layout_alignLeft="@+id/linearLayout1"
            android:text="TESTER : "
            android:textColor="#000000" />

        <AutoCompleteTextView
            android:id="@+id/tester_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ems="10"
            android:capitalize="characters" 
            android:textColor="#000000">

            <requestFocus />
        </AutoCompleteTextView>

    </LinearLayout>

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/linearLayout1"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="19dp"
        android:text="APPS TO TEST : "
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:textColor="#000000"/>




    <View
        android:id="@+id/view1"
        android:layout_width="wrap_content"
        android:layout_height="1dp"
        android:layout_below="@+id/textView2"
        android:background="#CCCCCC" 
        android:layout_marginBottom="5dp"/>

    <ListView
        android:id="@+id/apps_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/view1" 
        android:dividerHeight="5dp">
    </ListView>

    <Button
        android:id="@+id/refreshBtn"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:layout_alignBottom="@+id/textView2"
        android:layout_alignParentLeft="true"
        android:text="Refresh" /> …
Run Code Online (Sandbox Code Playgroud)

checkbox android

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

checkbox ×1