I want to display an image full-screen then dismiss when the user presses it.
I'm using a Dialog and it takes up about 80% of the screen. There's a white border around my image (it's not there in my file system).
How do I make this Dialog go completely full screen?
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean viewedInstructions = sharedPreferences.getBoolean("instructions_viewed", false);
if (!viewedInstructions) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("instructions_viewed", true);
editor.commit();
final Dialog d = new Dialog(this);
d.requestWindowFeature(Window.FEATURE_NO_TITLE);
d.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
d.setContentView(R.layout.instructions_dialog);
d.findViewById(R.id.tutorial).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
d.dismiss();
}
});
d.show();
Layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/dialog_layout_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
android:orientation="vertical"
android:padding="10dp"
>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/tutorial"
android:src="@drawable/dashboard_instructions"/>
</LinearLayout>
try changing this line
final Dialog d = new Dialog(this);
with
final Dialog d = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen);