【发布时间】:2015-06-27 03:21:46
【问题描述】:
在我的应用程序中,我有一个带有自定义行的 ListView,我想为每个项目添加一个自定义 CheckBox,如下所示:
当我点击“编辑”时,我希望 ListView 向右平移,并在每个 ListView 行的左侧显示一个自定义 CheckBox。
即使看不到某些行图标(如星形或箭头),是否可以将ListView 保持在右侧?或者,如果我翻译右边的ListView,行被压缩并且所有图标都可见?
我已经发了TranslateAnimation:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:fromXDelta="0%"
android:toXDelta="17%"
android:duration="750" />
</set>
我已经成功翻译了ListView,但在 2 秒后它又回到了初始位置……我该如何管理ListView 在TranslateAnimation 之后保持不变?
在行的左侧放置一个像“gone”这样的复选框,当按下“EDIT”按钮以使所有复选框都可见时会更好吗?在这种情况下,每一行是像图像一样向右平移还是被压缩并且所有图标都可见?
谢谢
编辑:
我的行 xml 文件:
<?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:background="@color/backgr_greysoft" >
<LinearLayout
android:id="@+id/row_information"
android:layout_width="fill_parent"
android:layout_height="@dimen/rowDescargas_height"
android:background="@drawable/button_file"
android:descendantFocusability="blocksDescendants"
android:layout_margin="@dimen/rowDescargas_marginLateral"
android:orientation="horizontal"
android:weightSum="1" >
<ImageView
android:id="@+id/icon"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_margin="@dimen/rowDescargas_marginIcono"
android:layout_weight="0.25" />
<LinearLayout
...
</LinearLayout>
</LinearLayout>
</RelativeLayout>
【问题讨论】:
-
不完全是你要找的东西,但this 应该给你一个公平的想法
标签: android android-layout listview checkbox android-listview