简体   繁体   English

图像右上角的CheckBox小部件

[英]CheckBox widget in the top right corner of an image

Currently I am downloading 2 images per row via Picasso. 目前,我正在通过毕加索下载每行2张图像。 I'd want to add a CheckBox in the top right corner of each of them. 我想在每个窗口的右上角添加一个CheckBox。 How should the checkbox be defined? 该复选框应如何定义? Here is the layout so far: 这是到目前为止的布局:

<!--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>

And the style: 和样式:

<style name="singleImage">
    <item name="android:layout_width">0dp</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_weight">1</item>
</style>

My comment its mean like this: 我的评论的意思是这样的:

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM