2016-10-19 7 views
0

現在、ピカソを経由して1行につき2枚の画像をダウンロードしています。私はそれらのそれぞれの右上隅にCheckBoxを追加したいと思います。チェックボックスはどのように定義する必要がありますか?画像の右上にあるCheckBoxウィジェット

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

とスタイル::

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

まず、あなたのレイアウトに2チェックボックスを追加し、その後、RelativeLayoutを使うここでは、これまでレイアウトがあります(ImageView_1とCheckBox_1)&(ImageView_2とCheckBox_2)をグループ化する – Sodiq

+0

Okeyですが、それらを整列させて画像上に表示する方法はありますか?あなたのアドバイスに続いて、彼らは単に画像を置き換えた。 – user6456773

+0

' ' – Sodiq

答えて

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

ああ、今私は理解した!ありがとう、それは素晴らしいです! – user6456773

+0

ようこそ... – Sodiq

関連する問題