画像をクリックしたときにオーディオを実行しているアプリケーションを実行していますが、オーディオの再生中にモードを横から縦に、または縦から横に変更して画像をクリックすると、別のオーディオクリップが再生されます。
例:
現在、2 つのオーディオが再生されています。ただし、同じモードで画像をクリックすると、この問題は発生しません。
モードが変更されたときに以前のアクティビティを停止する方法はありますか?
画像をクリックしたときにオーディオを実行しているアプリケーションを実行していますが、オーディオの再生中にモードを横から縦に、または縦から横に変更して画像をクリックすると、別のオーディオクリップが再生されます。
例:
現在、2 つのオーディオが再生されています。ただし、同じモードで画像をクリックすると、この問題は発生しません。
モードが変更されたときに以前のアクティビティを停止する方法はありますか?
問題に直面している現在のアクティビティでこのコードをAndroidManifestに追加しますが、これにより、方向を変更したときにアプリのドローアブルの変更が停止し、現在の方向が両方のモードで静的として使用されますが、それでも試してみてお知らせください。
<activity android:name=".CurrentActivity
android:configChanges="keyboardHidden|orientation">
</activity>
@venkyの回答を試しましたが、レイアウトが乱れています:(
縦向きの場合も、向きが変更された場合、ボタンも機能しません:(
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_prt"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="28dp"
android:orientation="horizontal" >
<ImageView
android:id="@+id/pause1"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:src="@drawable/pause" />
<ImageView
android:id="@+id/play1"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:src="@drawable/play" />
<ImageView
android:id="@+id/home1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="165dp"
android:src="@drawable/home" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="315dp"
android:orientation="vertical" >
<ImageView
android:id="@+id/kalma1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginLeft="40dp"
android:layout_marginTop="20dp"
android:src="@drawable/kalma1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal" >
<ImageView
android:id="@+id/next1"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:src="@drawable/forward" />
</LinearLayout>
ポートレート用の私のxmlであり、
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_lndscp"
android:orientation="vertical" >
<ImageView
android:id="@+id/kalma1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="33dp"
android:src="@drawable/kalma1" />
<ImageView
android:id="@+id/next1"
android:layout_width="30dp"
android:layout_height="20dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:src="@drawable/forward" />
<ImageView
android:id="@+id/play1"
android:layout_width="30dp"
android:layout_height="20dp"
android:layout_marginLeft="65dp"
android:layout_marginTop="41dp"
android:src="@drawable/play" />
<ImageView
android:id="@+id/pause1"
android:layout_width="30dp"
android:layout_height="20dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="41dp"
android:src="@drawable/pause" />
<ImageView
android:id="@+id/home1"
android:layout_width="30dp"
android:layout_height="20dp"
android:layout_alignBottom="@+id/play1"
android:layout_alignRight="@+id/kalma1"
android:src="@drawable/home" />
</RelativeLayout>
景観用