samedi 22 octobre 2016

How to align a checkbox in the top right corner of an image?

I want a checkbox to appear at the top of the image. At the moment, it's high above it. The problem appears when the ScrollView is added. Please, check the code below:

    <ScrollView
    xmlns:android="http://ift.tt/nIICcg"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fadeScrollbars="false"
            android:fillViewport="true"
            android:orientation="vertical">

    <LinearLayout
    xmlns:android="http://ift.tt/nIICcg"
        android:id="@+id/linLay"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:orientation="vertical">

<!--ROW 1 -->

            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

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

                <CheckBox
                    android:id="@+id/checkBox1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@android:color/holo_purple"
                    android:layout_marginBottom="0dp"
                    android:layout_gravity="top|end"
                    android:layout_alignTop="@id/img1"
                    android:layout_alignRight="@id/img1"/>
        </RelativeLayout>
    </LinearLayout>
    </ScrollView>




Aucun commentaire:

Enregistrer un commentaire