Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: start an intent into a framelayout
    text
    copied!<p>I have a main activity with this layout file:</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_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical" android:id="@+id/container" &gt; &lt;LinearLayout android:layout_height="wrap_content" android:id="@+id/header" android:background="@drawable/logo_bk" android:layout_width="fill_parent" &gt; &lt;Button android:id="@+id/btn_reload" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Reload" /&gt; &lt;LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_vertical|center_horizontal" &gt; &lt;ImageView android:id="@+id/ImageView01" android:src="@drawable/logo_head" android:scaleType="fitStart" android:adjustViewBounds="true" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;FrameLayout android:id="@+id/center" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1"&gt; &lt;/FrameLayout&gt; &lt;LinearLayout android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="center" android:id="@+id/footer" android:layout_weight="2.6" android:background="#ffffff"&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>Basically it is composed of a header, a central part (android:id="@+id/center") and a footer. The footer contains four dynamically created buttons. At the end it looks like a TabWidget with the tabs at the bottom.</p> <p>Each footer's buttons holds an intent/activity.</p> <p>The question is: How can I start my activity into the FrameLayout? For instance TabHost does this:</p> <pre><code>spec = tabHost .newTabSpec(tabTitle.toLowerCase()) .setIndicator(tabTitle,res.getDrawable(R.drawable.tab_spec)) .setContent(intent); tabHost.addTab(spec); </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