android-tabhost

Removing a tab and the activity (intent) inside of it from a TabHost

会有一股神秘感。 提交于 2019-12-20 01:17:30
问题 I have an app that can create tabs dynamically. And when I create a tab I initiate an activity as an intent. Like so: private void addTab(Context packageContext, Class<?> newClass, TabHost mTabHost, String tabId, String tabLabel){ // newClass is my Activity class that I want to start in the tab Intent intent = new Intent().setClass(packageContext, newClass); TabHost.TabSpec spec; spec = mTabHost.newTabSpec(tabId).setIndicator(tabLabel) .setContent(intent); mTabHost.addTab(spec); mTabHost

Android Tab Help. How to set 2nd tab as default when app opens?

北城余情 提交于 2019-12-19 17:44:29
问题 I have created an app with 3 tabs. The app works fine but I want the 2nd tab to be selected and loaded when the app opens. How can I set that? Here is my code : public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TabHost tabHost = getTabHost(); // Tab for Home TabSpec homespec = tabHost.newTabSpec("Home"); // setting Title and Icon for the Tab homespec.setIndicator("Home",getResources().getDrawable(R.drawable.icons_home

tabHost.setup() gives null pointer exception (Android studio)

六眼飞鱼酱① 提交于 2019-12-19 12:08:53
问题 I have a very simple app which is just an activity with a tab view on it. I have initialised and casted everything to as it should be but am continually getting a null pointer error which always links back to tabHost.setup(); I am using android studio and am new to java. This question has been asked a lot on here but all answers just say to include the setup() and I have already done that. Here is my .java file: package com.example.app; import android.support.v7.app.ActionBarActivity; import

Android Market-like tabbar

℡╲_俬逩灬. 提交于 2019-12-19 12:08:42
问题 What's the best way to implement an Android Market-like tabbar (Apps/Games/Downloads)? It would be great if I could use TabHost, but I believe it doesn't allow this level of customization. 回答1: As Cristian said, it's definitely possible using a TabHost , and you don't even need to use the androidtabs code that he links to. As of SDK level 4 (i.e. Android 1.6) you can pass a View to TabHost.TabSpec.setIndicator(), which will allow you to completely control the look of the tabs. However,

Problem running android HelloTabWidget example - NullPointerException on addTab()

依然范特西╮ 提交于 2019-12-19 09:00:45
问题 I've tried the Tab Layout example, and I've also fixed the few typos in the example (and added all the activities to the manifest). However, when I run it on the emulator I get a NullPointerException on the first line that says tabHost.addTab(spec); So my question, of course, is. What is wrong with the example that would cause this exception? I'm using Eclipse Galileo and set the target package as Android 1.5. So far I've had no other problems with the other examples on the android dev site.

Android TabHost Auto Scroll vertically in side ScrollView on TabChange?

不想你离开。 提交于 2019-12-19 05:07:09
问题 I am using TabHost inside ScrollView in my Activity but when ever I select tab it automatically scrolls my view vertically to end. 回答1: In this case child view getting focus due to that it get scrolled upward. for resolve this you need to create custom ScrollView that extend ScrollView. code snipt will look like this. public class MyScrollView extends ScrollView { public MyScrollView(Context context) { super(context); } public MyScrollView(Context context, AttributeSet attrs) { super(context,

What are the official Android recommendations for tabs?

爱⌒轻易说出口 提交于 2019-12-19 04:34:54
问题 I have to say I'm pretty lost when it comes to designing tabbed layouts on Android right now. The platform developers seem to be evolving the design faster than I can figure out their intentions. From what I can gather from the combination of the recently deprecated TabActivity and the new design guide, I think they intend for tabs to be exclusively with the Action Bar, either inside the main action bar or stacked on a secondary action bar. Though the developer's guide suggests using the

Back button very slow

馋奶兔 提交于 2019-12-19 04:12:14
问题 I have an android app with a TabActivity holding 4 tabs - a list view, a map view, another list and a webview. From the list view I can tap an item and it starts another activity, pressing back returns to the tab activity. However, once the map view tab has been visited, navigating to the second activity from the list view and then pressing the back button results in a hang of about 3-4 seconds. Once the map view has been visited, this problem never goes away until the app is exited. Some

Individual screen is showing instead of a tabhost in android eclipse

妖精的绣舞 提交于 2019-12-18 18:35:22
问题 i am self_learner to android. I have two screens.The first screen contains one edittext and a button,the edittext is to get the input from the user and button is to call the tabhost's activity which is on the second screen. During run time, after getting input from the user,it should show the appropriate values (as per the user's input) to any one of the tab of a tabhost which is on the second screen. But here my problem is,its showing the answer on the separate screen,not on the tabhost

Android TabHost inside Fragment

限于喜欢 提交于 2019-12-18 15:56:40
问题 I am working on an Android App and I have used android FragmentPager tabs example from developer.android.com), this example uses fragments for tabs contents, Now I want to place a tabHost inside one of those fragments, I have tried my best but the second tab hosts are not showing the content, I can see tab headers but no content, I am trying to use Intents as TabContent. I don't think I have any relevant code to post here, but If you need I can post it here. The hierarchy is: FragmentActivity