0

モバイルおよびタブレットデバイスで動作する Android 2.3.3 アプリケーションを開発しています。

背景画像付きのメインビューがあります。この画像にはボタンやその他のテキストがあり、それらのボタンの上にクリック可能な領域を作りたいです。これらは実際のボタンではなく、背景画像の一部です。

どうやってやるの?

ImageButtonボタンを透明にする方法がわからないので、画像なしを使用できるかもしれません。

4

3 に答える 3

1

クリック領域として Framelayout を使用し、ImageView をインジケーターとして使用することができます。例えば ​​:

    <FrameLayout 
        android:id="@+id/play_button_frame"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:background="@drawable/button_frame_colors">
        <ImageView 
            android:id="@+id/play_button_indicator"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="15dp"
            android:src="@drawable/button_indicator"
            android:background="@android:color/transparent"/>
        </FrameLayout>
于 2012-07-23T07:54:21.953 に答える
0

You can also place a layout with no background. It will work for sure as you want.

于 2012-07-23T20:43:16.700 に答える
0

カスタムImageViewを作成し、領域(四角形または座標)を定義し、onTouchイベントをリッスンし、タッチイベントが発生したときにリストを繰り返し処理し、ユーザーが定義された領域に触れた場合に反応します

于 2012-07-23T08:14:23.293 に答える