android-tabhost

StateListDrawable to switch colorfilters

走远了吗. 提交于 2019-11-28 23:44:25
I want to create custom buttons to use in a TabHost. I haven been trying to just use the same image resource (png), but have the colorfilter change depending on the state. So I made this bit to serve as the layout for the custom button: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/tab_icon" android:layout_centerInParent="true" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_width="wrap

Drawing number badge like iPhone in Android

爱⌒轻易说出口 提交于 2019-11-28 18:28:43
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. ccheneson 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:layout_height="wrap_content" > <ImageView android:id="@+id/icon" android:src="@android:drawable/ic_menu

Android 1.6 TabHost inside a Fragment

别来无恙 提交于 2019-11-28 12:48:08
In the demo Support4Demos - API 4+ Support Demos , the Tabs and TabsPager examples both extend FragmentActivity. Each tab content is itself a Fragment. No real breakthrough, TabActivity was used the same way without the introduction of Fragment. Now suppose inside my Activity , a screen portion is a Fragment named WidgetFragment. How is it possible for WidgetFragment to contain a TabHost ? Visualize a mini TabHost contained inside an Activity. I tried every possible way to insert a TabHost inside a Fragment not a FragmentActivity. In generally accepted practices, Tabs fit the whole screen.

OnActivityResult is not working in TabActivityGroup?

心已入冬 提交于 2019-11-28 11:52:46
问题 I am using Tab Activity as a main Activity in which it has 4 tabs. One tab is Activity Group which has three buttons. Each button is one activity. I am using camera in one of those activity. I know its working because i have checked in the memory card the image get saved, but it doesn't calling the Onactivityresult() method. This is to display the ContentView public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); View viewToLoad = LayoutInflater.from(this

How to get rid of horizontal scroll bar in tabhost?

我是研究僧i 提交于 2019-11-28 11:40:24
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:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="bottom" /> <

How to programmatically switch tabs using buttonclick in Android

不问归期 提交于 2019-11-28 10:45:47
I have been struggling with this for a few days now. I'm trying to switch tabs programmatically upon a button click. My program works flawlessly if I just use the tabs to change activities, but wiring an onClick method with setCurrentTab results in an error. This is the method that will not work. It's a pretty basic and straightforward function but I haven't seen much documentation or examples of people attempting to wire a buttonclick with switching tabs. Thanks. ImageButton next = (ImageButton) findViewById(R.id.ButtonAsk); next.setOnClickListener(new View.OnClickListener() { public void

Android FragmentTabHost - Not fully baked yet?

♀尐吖头ヾ 提交于 2019-11-28 09:46:06
I wanted to see if anyone has had success with customization of tabs using FragmentTabHost that comes with the new Android API level 17. I was excited to be able to nest a tabHost within my ViewPager SherlockFragments, but I'm having trouble doing simple things like moving the tabs to the bottom or changing the layout of the tabs. Has anyone seen a good example of using this functionality? This is the only example I could find in the Android docs, and theres just about nothing that describes its use. It also seems to ignore whatever is defined in the layout for R.id.fragment1 . My question I

Setting selected TAB with a small triangle below it

送分小仙女□ 提交于 2019-11-28 09:28:46
I want my tabs to show like in the image with small triangle below it.Is this possible ?If yes, then help me with some codes or documentation. I think, the following approach is the simplest one. You just need to setup the following drawable (actually, it's Android's default drawable for tabs) as a background of the tabs: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Non focused states --> <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected

Delay initialization when using Fragment in Android

╄→гoц情女王★ 提交于 2019-11-28 09:24:03
问题 When one fragment A is changed to another fragment B, it will call onCreate() and some other functions to do initialization. After the Fragment has changed, the fragments near the current fragment also will be initialized. For example: I have 5 fragments A, B, C, D, E. The current fragment is A. When I change to D, D along with C and E will be initialized. My Problem is: Some codes are very slow to execute so I want to initialize a part of the data instead of ALL of the data. That is, when

java.lang.IllegalStateException: No activity

删除回忆录丶 提交于 2019-11-28 09:20:45
I'm building an Android app for which I'd like my first activity to be composed of 2 tabs, one for the user's profile, and one for the friends' activity. For these tabs, I opted for a TabHost since my Sherlock Action Bar is already using list navigation to move to other activities so I can't use tab navigation from the action bar. The app worked for a while, but now only one of my tabs works, as soon as I try to move to the second tab, I'm getting a java.lang.IllegalStateException: No activity I added the Logcat output for this error, although I'm not sure it helps since there is no trace back