android-tabhost

Custom tabs in android [closed]

做~自己de王妃 提交于 2019-11-27 19:53:07
I'm having a really hard time understanding how to use custom tabs in android. I don't want to just be able to set the text and stuff. How can I change the size, and the image, and all that. I've googled and I can't find anything that makes sense You can create XML layout file in /res/layout. Then you need inflate layout in View and set indicator. I use this code in my projects: private static View prepareTabView(Context context, int textId, int drawable) { View view = LayoutInflater.from(context).inflate(R.layout.tab_layout, null); // setting text and image // ... // Write your own code here

Android onActivityResult NEVER called

人盡茶涼 提交于 2019-11-27 16:23:01
my onActivityResult method is never called. am using android 2.2 I am using a Tabhost, where TabHosts contain TabGroups which contain individual Activities. One of my individual activity runs the following intent Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), 0); this loads my gallery apps, I use the default android gallery to select one image and when I return my onActivityResult is not called my activity. It looks like this - and I put a breakpoint at if(resultCode ==

Best way to implement tabs in android?

那年仲夏 提交于 2019-11-27 15:51:13
I have read looked through some code that implements tabs on the bottom of the app's page. And there is no deprecated method/class inside the code, and to me it is a very easy and clean way to implements tabs. But I heard the new way of implementing tabs is to use fragments. So, which one is better? And why? XML: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TabHost android:id="@+id/edit_item_tab_host" android:layout_width=

Update tabs from a tab's activity in a Android TabHost

馋奶兔 提交于 2019-11-27 15:33:58
I have a TabActivity and am going to have 3 or 4 tabs. In TabA, I would like to have an ExpandableListView, which will list products. I would like TabC to act as a sort of "shopping cart", probably with a ListView of itself. Is there a way to interact with the TabHost from the Activity? I would like to be able to click a button inside of TabA and have it update and switch to TabC. Is this possible? Can I get the Tab's activities call its parents methods? If you implement your tabs as views, rather than individual activities, this would be far simpler, run faster, take up less memory, and be a

onActivityResult not call in the Fragment

喜你入骨 提交于 2019-11-27 15:09:43
The structure of the app is like this: tabHost (in Activity) -> contains -> TabFragment(extend base container fragment) 1. The code in Activity : tabHost.addTab( tabHost.newTabSpec("home").setIndicator("", getResources().getDrawable(R.drawable.btn_home)), HomeFragment.class, null); 2. The code in HomeFragment (Notice that HomeFragment is not the actual function but a container like this, and it extend BaseContainerFragment): public class HomeFragment extends BaseContainerFragment { public Home homeFrag; private boolean mIsViewInited; @Override public View onCreateView(LayoutInflater inflater,

Drawing number badge like iPhone in Android

我的梦境 提交于 2019-11-27 11:22:23
问题 I want to draw the number badge as shown in the above image on the Chats tab. That number badge shows number of new unread messages in chat. So how can I draw this kind of custom number badge. Is there any inbuilt API in Android SDK? Thanks in advance. 回答1: Look at my answer here for widgets/app. You can use shapecount.xml res/layout/tabicon.xml <RelativeLayout android:orientation="vertical" android:background="@null" android:id="@+id/rlayout" android:layout_width="wrap_content" android

Is there any way to change android:windowSoftInputMode value from java class?

孤街浪徒 提交于 2019-11-27 06:46:59
I want to act my tabs to have different windowSoftInputMode properties for each tab. How to access this property from java class when all handling of your tab is done from one single activity? Is there any way to access this manifest property from java code? Use the following to change the softInputMode for an Activity. getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); Use the following to change the softInput type for an EditText. mEditText.setImeOptions(EditorInfo.IME_ACTION_DONE); Thanks to @Eliezer for correction aman According to Prasham's comment , I did

How to get rid of horizontal scroll bar in tabhost?

落花浮王杯 提交于 2019-11-27 06:23:49
问题 I want to get rid of horizontal scroll bar in TabHost. It's there even if TabWidget is on top. Below is my xml layout. <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" > <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"/> <TabWidget android:id="@android:id/tabs"

Android how can i replace the deprecated tabhost?

浪子不回头ぞ 提交于 2019-11-27 05:10:54
I'm going to create an application which is designed to use Tabhost , but as I know it's been deprecated. So my question is should I use Tabhost anyway or how can I replace it..by using buttons instead of them declared in every xml or any other suggestions? "Deprecated" in Android means "we think there is a better solution that you should investigate". Rarely does "deprecated" mean "it is unusable". TabHost , AFAIK, works fine on Android 4.0. That being said, I would recommend considering switching to tabs in the action bar, using ActionBarSherlock to give you backwards compatibility to

Issues with Android TabHost Example

最后都变了- 提交于 2019-11-27 04:26:54
I have been attempting to implement the 'advanced' tabwidget example from google. But, when it tries to call tabHost.addTab(spec); I get a stack trace from the debugger. Sorry, I don't have the stack trace here, but I'm wondering if others have had this same issue (as this code had a number of typo's and missing information that stopped me from even compiling. Can anyone point me to a corrected/running version of this code? The updated information needed are: <activity android:name=".ArtistsActivity"></activity> <activity android:name=".AlbumsActivity"></activity> <activity android:name="