ユーザーが 3 つのイメージ ビュー (カード) の 1 つで TAP を実行してカードをプレイする単純なカード ゲームを作成しましたレイアウトまたは単に画面の別の部分)。
http://blahti.wordpress.com/2011/01/17/moving-views-part-2/に示されている技術を使用しようとしました が、AbsoluteLayout を使用しているため、現在のレイアウトに多くの制限が生じます。アプリが実行されているデバイスの画面解像度に応じて調整が必要です。可能であれば、RelativeLayoutを使用し続けることを避けたいと思います。たぶん、開始点は onTouch サポートを追加して ImageView を拡張することですが、希望する効果を再現できませんでした (ドラッグ) アイデア、提案、またはサンプル コードはありますか? ありがとう!
参考までに、これはレイアウトのドラフトです。下の 3 枚のカードはドラッグで移動する必要があります。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
>
<RelativeLayout android:id="@+id/player_cards_layout"
android:layout_width="fill_parent" android:layout_height="150dip"
android:gravity="center_horizontal"
android:background="#55335588"
android:layout_above="@+id/player_cards_layout"
>
<ImageView android:id="@+id/img_pc_card_1"
android:layout_width="100dip" android:layout_height="150dip"
android:src="@drawable/icon"
/>
</RelativeLayout>
<RelativeLayout android:id="@+id/player_cards_layout"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center_horizontal"
android:background="#336699"
>
<ImageView android:id="@+id/img_user_card_1"
android:layout_width="100dip" android:layout_height="150dip"
android:src="@drawable/icon"
/>
<ImageView android:id="@+id/img_user_card_2"
android:layout_width="100dip" android:layout_height="150dip"
android:src="@drawable/icon"
android:layout_toRightOf="@+id/img_user_card_1"
/>
<ImageView android:id="@+id/img_user_card_3"
android:layout_width="100dip" android:layout_height="150dip"
android:src="@drawable/icon"
android:layout_toRightOf="@+id/img_user_card_2"
/>
</RelativeLayout>
</RelativeLayout>