android-tabhost

How to make Andorid's ActionBar/TabWidget LinearLayout to wrap it's children

↘锁芯ラ 提交于 2019-12-11 10:41:13
问题 I try to implement the scrollable tabs where each tab has it's size adjusted to it's content size. I tried two approaches: ActionBar and TabHost. In both cases I was able to adjust tabs sizes. To achieve that I setLayoutProperites on each Tab after given Tab was added. In both cases the same approach. The weight is changed to 0 and width is set to WRAP_CONTENT. Below the TabHost related example. LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) tabHost.getTabWidget()

Workaround for the absence TabSpec.setIndicator(View view) on Android API level <4

ぃ、小莉子 提交于 2019-12-11 10:06:17
问题 I need to use my custom view for the indicators of my TabHost. With Android API level >=4 no problem but in the Android API level <4 this method is not implemented. Any suggestion? I was thinking to implement this method but unfortunately the TabHost class does not allow changes because has all attributes private and not protected. Thanks. 回答1: I suggest use reflection: private void setIndecator(TabHost.TabSpec tabSpec, String label) { LayoutInflater vi = (LayoutInflater) getSystemService

How to use custom iPhone tab in FragmentActivity?

浪子不回头ぞ 提交于 2019-12-11 09:43:01
问题 I am new in Android and I tried to create a tab using FragmentActivity from codes that I found online. http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/ This is my FragmentActivity http://pastie.org/pastes/5170802/text?key=jhowuevxe2fshlwu5tisg I would like to use a custom layout that uses an image and text. //tab_indicator.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width=

FragmentTabHost with own fragment stack for each tab

风格不统一 提交于 2019-12-11 07:44:52
问题 I have MainActivity which has FragmentTabHost with several tabs. Each fragment in tab can be replaced with another fragment, so if we navigate back, we will see first displayed fragment for this tab (own stack for each tab). I have a quite working solution. The below example demonstrates TabHost with 2 tabs and fragment classes for the first tab. Is there any simpler, better or more elegant way to achieve this result? AbstractPrimaryFragment.java. This class is a root fragment class that

In android, how can I put tabs in a view containing an image on top?

≡放荡痞女 提交于 2019-12-11 07:39:51
问题 I am creating an android application and am trying to add three tabs underneath a picture and some text. ______________________________ | _____________ | | | | text | | | picture | text | | | | text | | ————————————— | | _______ ________ _______ | | | tab | | tab | | tab | | | ———————————————————————— | | | | | | | | | | | content | | | | here | | | | | | | | | | | | —————————————————————————————— I do not know exactly how to accomplish this. Any ideas would be greatly appreciated. Thank you.

Why Back button is not detecting in muti tab activities?

心不动则不痛 提交于 2019-12-11 07:18:27
问题 I have Main Activity. That has 4 tabs( TabHost ). I have overridden onBackPress() in MainActvity , as well As All 4 activities. This button show user a dialog box and for conformation of Exit When app start. It show 1st tab. Then if I press back it work fine. But if I go for next 3 tab and then press back, The app stop. OnDestroy() of Main is called. But there is not dialogue for the user.Even noting is print in log cat. That I have written in onBackPressed() method From and of 5 activities

Android dynamic tab

依然范特西╮ 提交于 2019-12-11 06:58:18
问题 How create dynamic tab in android?. If user want to add tab dynamically on the tabhost . How it possible? 回答1: check this blog. in this example add tab by click on button check out http://sankarganesh-info-exchange.blogspot.com/2011/04/adding-tabs-dynamically-in-android.html another link add tab from option menu http://knol.google.com/k/tabs-and-tabhost# 回答2: The procedure to add a tab (whether dynamically or otherwise) is similar. You need A TabHost object A TabSpec (that you could create

Show a progress dialog in android tab layout

青春壹個敷衍的年華 提交于 2019-12-11 05:04:31
问题 I need to show a progress dialog, while clicking a tab, My code id public class SIPTabWidget extends TabActivity{ Intent intent; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.main); final Resources res = getResources(); // Resource object to get Drawables final TabHost tabHost = getTabHost(); // The activity TabHost

Using views instead of an activity for each tab

…衆ロ難τιáo~ 提交于 2019-12-11 04:53:14
问题 This is actually extended version of Alternatives to using an activity for each tab. The point is using views instead of activity is actually a good idea. If I have a button or some text then its fine. But what if I actually want an activity to be started on tab change, like a camera ? Is it still efficient to use views instead of activity ? If so, how do I do it ? Because calling new intent everytime is also heavy on memory I think. 回答1: If you want an activity launched with a tab change,

In Android app,I changed all px to dp and sp. Now it is not opening. What is wrong?

孤街醉人 提交于 2019-12-11 04:35:37
问题 I had many objects using px. I changed everything in my app to dp and textsizes to sp. Now my app won't open. When I use the debugger and go step by step it does open and then displays this. I did not change any code from before when it was working, just the px. By the way, I am using tabHost and their should be 5 tabs on the bottom. It splits it into about 30. It is just very strange stuff going on. Do you know what is wrong and how to fix it? Thank you. This image is the error message: This