Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid. First tab visible under second tab
    primarykey
    data
    text
    <p>When the second tab is clicked the contents are shown over the content of the first tab. The first tab contents are still visible underneath. Here's some sample code:</p> <p>MainActivity.java</p> <pre><code> public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Home tab Intent intentHome = new Intent().setClass(this, home.class); TabSpec tabSpecHome = tabHost .newTabSpec("Home") .setIndicator("Home", ressources.getDrawable(R.layout.icon_home)) .setContent(intentHome); // Tools tab Intent intentTools = new Intent().setClass(this, tools.class); TabSpec tabSpecTools = tabHost .newTabSpec("Tools") .setIndicator("Tools", ressources.getDrawable(R.layout.icon_tools)) .setContent(intentTools); </code></pre> <p>ToolsActivity.java</p> <pre><code>public class tools extends Activity { public static tools self; private ImageButton imageButton1; private WebView webView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tools); addListenerOnButton1(); public void addListenerOnButton1() { imageButton1=(ImageButton)findViewById(R.id.imageButton1); imageButton1.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { setContentView(R.layout.activity_web); webView = (WebView) findViewById(R.id.webView1); webView.getSettings().setJavaScriptEnabled(true); webView.setWebViewClient(new WebViewClient()); webView.loadUrl("file:///android_asset/www/tools/calculators.html"); webView.setBackgroundColor(Color.parseColor("#111111")); } }); } </code></pre> <p>MainActivity.java uses activity_main.xml and Tools.java uses activity_tools.xml both of which are the same in layout but differ slightly in content.</p> <p>I tried putting Finish(); at the end of each TabSpec in MainActivity.java but that simply closed the app in the emulator as I suspected it would.</p> <p>Does anyone have any guidance they could give me?</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    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. 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