English 中文(简体)
如何去除/取代在甲体内的刺 to活动?
原标题:How to remove/replace tab activities in android?

我已执行4个表格,每个表格都有活动。 是否宜取消/取代这些活动,以更好地履行使命? 如果是,如何做到这一点?

问题回答

I really doubt that having 3 tabs instead of 4 will noticeably change performance. You need to have as many tabs as suits your app. In my app, I need 4 tabs because if I had 3, then the use ability would be bad, and it would be confusing to navigate.
If you want 5+ tabs, then I d recommend doing away with the tabwidget and then implement your own custom layout (possibly a horiziontal scrollview) as is implemented in WeatherBug. Then on that custom layout, on each button or imageView or whatever is in your custom layout, you would call setCurrentTab in an onClick for the views.

我有4个这样的表格:

intent = new Intent().setClass(this, ActivityTabOther.class);
        spec = tabHost.newTabSpec("other").setIndicator("General",
                          res.getDrawable(R.drawable.other))
                      .setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, ActivityTabLocate.class);
        spec = tabHost.newTabSpec("locate").setIndicator("Locate",
                          res.getDrawable(R.drawable.locate))
                      .setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, ActivityTabSecure.class);

        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("secure").setIndicator("Secure",
                          res.getDrawable(R.drawable.secure))
                      .setContent(intent);
        tabHost.addTab(spec);
        //If you want to remove a tab, delete everything from here down, and that s minus one tab.
        intent = new Intent().setClass(this, ActivityTabFriends.class);
        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("friends").setIndicator("Friends",
                          res.getDrawable(R.drawable.findabuddy))
                      .setContent(intent);
        tabHost.addTab(spec);




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签