2017-05-18 1 views
0

私は単純なGridView Galleryを作成します。私はいくつかの写真を表示します。今私はそれらにチェックを入れようとしています。チェックボックスはイメージ上に表示されますが、クリックアクションは機能しません(onItemClickの前に私は画像を拡大しました)。つまり、チェックボックスの場所以外の写真をクリックするとズームしますが、チェックボックスをクリックすると、チェック/チェックが外されます。チェックボックスがその一部にある場合、ImageViewの実行が停止する

私のxmlファイル:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 


    <ImageView 
     android:layout_width="@integer/width" 
     android:layout_height="@integer/height" 
     android:adjustViewBounds="true" 
     android:id="@+id/imageView" 
     android:layout_margin="5dp" 
     android:layout_centerVertical="true" 
     android:layout_alignParentEnd="true" /> 

    <CheckBox 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_alignRight="@+id/imageView" /> 


</RelativeLayout> 
+0

にこれらattributtesを追加してみてください –

+0

ohh man hole galleryそれはかなり複雑ですか?なぜなら、レイアウトでこのチェックボックスを削除すれば、このすべてがうまくいくということです。写真はズームなどですが、チェックボックスのような行為は、このImageViewの上に表示されますが、彼はwrap_contentなので、私はそれを取得しません。 –

+0

"Android:layout_alignRight =" @ + id/imageView "" –

答えて

1

があなたのxmlのCheckBox

android:clickable="false" 
android:focusable="false" 
+0

アンドロイドを追加すると:clickable = "false"チェックボックスを使用することはできません:)しかし、この2行目仕事をする:) –

0

あなたは、私はそれを確認することができるようにあなたのコードを提供することができ、この

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

     <ImageView 
      android:id="@+id/imageView" 
      android:layout_width="150dp" 
      android:layout_height="150dp" 
      android:layout_centerVertical="true" 
      android:layout_margin="5dp" 
      android:adjustViewBounds="true"/> 

     <CheckBox 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true"/> 

     </FrameLayout> 
関連する問題