CheckBox小部件位于图像的右上角

时间:2016-10-19 02:45:03

标签: android image checkbox picasso clickable

目前我正在通过Picasso每行下载2张图片。我想在每个人的右上角添加一个CheckBox。如何定义复选框?到目前为止,这是布局:

out = [1 2 3 4].' * A;

风格:

<!--Row1-->
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dip"
    android:orientation="horizontal"
    android:layout_weight="1">

        <ImageView
            android:id="@+id/img1"
            style="@style/singleImage"
            android:layout_marginRight="10dp"/>


        <ImageView
            android:id="@+id/img2"
            style="@style/singleImage"/>
</LinearLayout>

1 个答案:

答案 0 :(得分:2)

我的意见是这样的意思:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:orientation="horizontal">

    <RelativeLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1">

        <ImageView
            android:id="@+id/img1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginRight="10dp" />

        <CheckBox
            android:id="@+id/checkBox1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:text="" />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1">

        <ImageView
            android:id="@+id/img2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginRight="10dp"
            android:layout_weight="1" />

        <CheckBox
            android:id="@+id/checkBox2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:text="" />
    </RelativeLayout>
</LinearLayout>
相关问题