私は2人のプレーヤーが同時に遊ぶAndroidゲームをコーディングしています。一方のプレイヤーは通常の方法で電話を受け、もう一方のプレーヤーは逆さまになります。Androidはレイアウトを逆さまにしたり、180度回転したりします。
クイズなので、私はキャンバスやグラフィックを使用しませんでした。これには2つの線形レイアウトしか含まれておらず、そのうちの1つは上下逆さまになっています。このために、私は次のものを使用しました:
android:rotation="180"
レイアウトの1つ。
Eclipseのmy xmlのグラフィカルビューでは逆さまになっていましたが、エミュレータや携帯電話でそれを実行すると、180度回転したり回転したりしません。
XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" android:clipToPadding="false"
android:rotation="180">
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</LinearLayout
Javaコード
public class x extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
は、どのように私は複雑化せずに、それを回転させることができます。私は現在APIレベル15を使用していますが、私はAPIレベルに制限はありません。
私は任意の相対レイアウトを使います。 – akhil
私は線形レイアウトを使用しました。 – akhil
そこに私は線形レイアウトが物事をcompilcatingせずに回転させることができない方法です。 – akhil