2017-01-28 19 views
0

私のアプリでは、Imageviewで多くのクリック可能な領域を作成したいと考えています。私はimageviewに(マイントリップ、marginleftなどを使用して)ボタンを配置しようとします。しかし、別の携帯電話に..異なる位置にこれらのボタンが表示されます(それのサイズに応じて)Android Studio XML ImageViewに必要なクリック可能な領域

だから私は私のImageViewのでクリッカブル領域を作るために何をすべきか....私はほとんど42クリッカブルエリアを...必要

+0

これに応じてframelayoutとaddボタンを使用します。 – Mrinmoy

+0

@mrinmoyどのように?たとえば:再生、次、前、繰り返し、円内のコントロールをシャッフルする音楽プレーヤーアプリの場合、どうやって整列させることができますか? –

答えて

1

後あなたは下の画像を確認したいビュー

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

    <RelativeLayout 
     android:layout_width="200dp" 
     android:layout_height="200dp" 
     android:layout_gravity="center" 
     android:background="@drawable/circle"> 


     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@android:drawable/ic_media_play" 
      android:layout_centerInParent="true"/> 

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@android:drawable/ic_media_next" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="8dp"/> 

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@android:drawable/ic_media_previous" 
      android:layout_centerHorizontal="true" 
      android:layout_alignParentBottom="true" 
      android:layout_marginBottom="8dp" 
      android:layout_marginTop="8dp"/> 

     <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@android:drawable/ic_media_ff" 
     android:layout_centerVertical="true" 
     android:layout_marginLeft="8dp" 
     android:layout_marginTop="8dp"/> 

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@android:drawable/ic_media_rew" 
      android:layout_centerVertical="true" 
      android:layout_alignParentRight="true" 
      android:layout_marginRight="8dp" 
      android:layout_marginLeft="8dp" 
      android:layout_marginTop="8dp"/> 

    </RelativeLayout> 

    </FrameLayout> 

をachiveできる使用してコードである: -

enter image description here

関連する問題