Note that there are some explanatory texts on larger screens.

plurals
  1. POaddView FILL_PARENT not working
    primarykey
    data
    text
    <p>I want to put a layout into another one via layoutInflater.</p> <p>Here's the main_layout.xml file:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;ImageView android:id="@+id/ads_image_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:src="@drawable/ic_launcher" /&gt; &lt;RelativeLayout android:id="@+id/host_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/navigation_buttons_layout" android:layout_alignParentLeft="true" android:layout_below="@+id/ads_image_view" &gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/navigation_buttons_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" &gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:text="Button" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p> and here's the vitrin_layout.xml file:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ff0000" android:text="smallred" /&gt; </code></pre> <p>and finally the onCreate method for my main activity:</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_layout); ViewGroup parent = (ViewGroup) findViewById(R.id.host_layout); View view = LayoutInflater.from(getBaseContext()).inflate( R.layout.vitrin_layout, null); parent.addView(view, LayoutParams.FILL_PARENT); setTitle(getString(R.string.title_activity_vitrin)); } </code></pre> <p>The problem is that the vitrin_layout, does not fit into its parent(host_layout); although I've set fill_parent where ever I could! <br/>I can't figure out why.</p> <p>Edited: I'm really sorry, but i'd pasted wrong vitrin_layout file, I fixed it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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