Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've managed to answer this for myself so I'll post the solution in here in case someone else has the same question.</p> <p>I added a TabActivity as well as the standard Preferences activity, then nested the Preferences inside a Tab of the TabActivity. This means I've got a normal layout xml for the TabActivity that I can put an adview (or any other type of view) inside and I've still got the generated preferences screen working within that.</p> <p>Code for the TabActivity</p> <pre><code>public class SettingsTabActivity extends TabActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tablayout); TabHost tabHost = getTabHost(); // The activity TabHost TabHost.TabSpec spec; // Resusable TabSpec for each tab Intent intent; // Reusable Intent for each tab // Create an Intent for the regular live wallpaper preferences activity intent = new Intent().setClass(this, Preferences.class); // Initialize a TabSpec and set the intent spec = tabHost.newTabSpec("TabTitle").setContent(intent); spec.setIndicator("TabTitle"); tabHost.addTab(spec); tabHost.setCurrentTab(0); } } </code></pre> <p>Code for the tablayout.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TabHost xmlns:android="http://schemas.android.com/apk/res/android" xmlns:myapp="http://schemas.android.com/apk/res/*your package name goes here for admob*" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;com.admob.android.ads.AdView android:id="@+id/ad" android:layout_width="fill_parent" android:layout_height="wrap_content" myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF" myapp:secondaryTextColor="#CCCCCC" /&gt; &lt;TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="1dp" android:tabStripEnabled="false" android:visibility="invisible" /&gt; &lt;FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="1dp" /&gt; &lt;/LinearLayout&gt; &lt;/TabHost&gt; </code></pre> <p>Setting android:visibility="invisible" and android:layout_height="1dp" on the TabWidget tag means the user can't tell it's actually a Tab</p>
    singulars
    1. This table or related slice is empty.
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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