Uprościliśmy mój problem do najmniejszego przykładu, kiedy można go odtworzyć.VideoView nie jest poprawnie renderowany po zniknięciu klawiatury Dialog
Więc:
- 1 aktywność z VideoView i ImageView.
- Po kliknięciu na ImageView pojawia się AlertDialog.
- AlertDialog ma 1 pole EditText.
- Dotykam tego EditText i wyświetlana jest standardowa klawiatura systemu Android.
- Zamknij klawiaturę.
- Zamknij okno dialogowe.
problem: Granice VideoView'S (czarny prostokąt), a zatem rozszerzono ImageView nie wykazała już.
Każda pomoc jest doceniana! Dzięki.
Kod:
MainActivity.java
import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.VideoView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Activity act = this;
final VideoView videoView = (VideoView) findViewById(R.id.videoView1);
videoView.setVideoPath("/mnt/sdcard/s1ep01.mp4");
videoView.requestFocus();
findViewById(R.id.imageView1).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
AlertDialog.Builder builder = new AlertDialog.Builder(act);
View view = LayoutInflater.from(act).inflate(R.layout.dialog, null);
builder.setView(view);
builder.setPositiveButton("Save translation", null);
builder.setNegativeButton("Cancel", null);
AlertDialog dialog = builder.create();
dialog.show();
}
});
}
}
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<VideoView
android:id="@+id/videoView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/videoView1"
android:src="@android:drawable/btn_dialog" />
</RelativeLayout>
dialog.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="wrap_content">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
Myślę, że w tym przypadku jest bezpiecznie dodać do swojej aktywności w manifeście 'android: windowSoftInputMode =" adjustNothing "'. –