关于ListActivity中的CheckBox解决办法
关于ListActivity中的CheckBox
我在列表中列出一队内容,每一栏左边应该有个CheckBox,但是在一般情况下不要显示它。
在按了“编辑”键才显示它,同时将原来的内容往右推开。
请问怎么做呢?
这是我的界面设计,我想关键点是,这个marginLeft能不能通过程序重设一下?
android:layout_marginLeft="35dp"
------解决思路----------------------
------解决思路----------------------
2楼说的对,设置在checkbox布局设置visibility=gone,右侧部分相对checkbox布局,长按后显示checkbox即可
我在列表中列出一队内容,每一栏左边应该有个CheckBox,但是在一般情况下不要显示它。
在按了“编辑”键才显示它,同时将原来的内容往右推开。
请问怎么做呢?
<?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" >
<RelativeLayout
android:id="@+id/relative_20"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<CheckBox
android:id="@+id/select"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
/>
<RelativeLayout
android:id="@+id/relative_21"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
>
<TextView
android:id="@+id/caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/datetime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/caption"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/relative_22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_alignParentRight="true"
>
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/date"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/relative_23"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/relative_21"
android:layout_marginLeft="35dp"
>
<TextView
android:id="@+id/remark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
这是我的界面设计,我想关键点是,这个marginLeft能不能通过程序重设一下?
android:layout_marginLeft="35dp"
------解决思路----------------------
那你可以试着给 checkbox 设置一个属性,visibility=gone;
------解决思路----------------------
2楼说的对,设置在checkbox布局设置visibility=gone,右侧部分相对checkbox布局,长按后显示checkbox即可