Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try switching to a <code>LinearLayout</code> instead of <code>RelativeLayout</code>. I was targeting the 3.0 Honeycomb api when testing. </p> <pre><code>public class FragmentDialog extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button button = (Button) findViewById(R.id.show); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { showDialog(); } }); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); } void showDialog() { FragmentTransaction ft = getFragmentManager().beginTransaction(); DialogFragment newFragment = MyDialogFragment.newInstance(); newFragment.show(ft, "dialog"); } public static class MyDialogFragment extends DialogFragment { static MyDialogFragment newInstance() { MyDialogFragment f = new MyDialogFragment(); return f; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_dialog, container, false); return v; } } } </code></pre> <p>and the <strong>layouts</strong>: <strong>fragment_dialog.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:minWidth="1000dp" android:minHeight="1000dp"&gt; &lt;/LinearLayout&gt; </code></pre> <p><strong>main.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff"&gt; &lt;Button android:id="@+id/show" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0" android:text="show"&gt; &lt;/Button&gt; &lt;/LinearLayout&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload