android-tabs

Set tab indicator position programatically in TabLayout support library

怎甘沉沦 提交于 2020-01-03 16:49:41
问题 In my application i am using TabLayout from support library with view pager.I have 3 fragments in it.Suppose i am in fragA which has a button which on clicked takes me to fragB.I am sucessfully going to fragB but only problem is that the tab indicator remains at fragA. Code private void setupTablayout() { tabLayout = (TabLayout) findViewById(R.id.tabLayout); tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); tabLayout.setupWithViewPager(viewPager); viewPager.setCurrentItem(1, true); tabLayout

Any Alternate method for Class Casting

本秂侑毒 提交于 2020-01-03 15:22:34
问题 Following statement is not executing on some devices. AddEvent act1 = (AddEvent) getLocalActivityManager().getCurrentActivity(); Is there any alternate method for above statement. On some devices it works fine but on other devices it gives exception. Edit: My application is developed in tab. OnActivity results is used for getting picture from camera activity. Dont know where the resides but when I puts the above statement in try catch then no force close occurs and exception is shown there.

Any Alternate method for Class Casting

非 Y 不嫁゛ 提交于 2020-01-03 15:21:26
问题 Following statement is not executing on some devices. AddEvent act1 = (AddEvent) getLocalActivityManager().getCurrentActivity(); Is there any alternate method for above statement. On some devices it works fine but on other devices it gives exception. Edit: My application is developed in tab. OnActivity results is used for getting picture from camera activity. Dont know where the resides but when I puts the above statement in try catch then no force close occurs and exception is shown there.

How to change the color of tab indicator

蓝咒 提交于 2020-01-02 10:28:35
问题 I am using tabHost in my application and the requirement is that when any tab is selected the color of tab indicator should change ,I referred this example How to set Tab View Indicator background color in Android but i didn't understood Here is my code: TabHost tabHost = getTabHost(); // The activity TabHost TabHost.TabSpec spec; // Reusable TabSpec for each tab Intent intent; // Reusable Intent for each tab // Create an Intent to launch an Activity for the tab (to be reused) intent = new

How to add dynamic fragment tab items

微笑、不失礼 提交于 2020-01-02 01:20:25
问题 I want to add dynamic tab items. I have a fragment which is FragmentOne and it has a TextView. I'm trying create FragmentOne in foreach and add to tabs. I tested code which is in setupViewPager but it doesn't work. How can I edit TextView which in fragments? if I remove this lines it works but contents of fragment always show default that = "TAB ONE". I want to edit all TextView which is in fragments that created at run time; View view = fView.getView(); TextView txtTabItemNumber = (TextView

Creating Tabs inside Fragment

浪尽此生 提交于 2020-01-01 19:55:49
问题 I'm getting a fragment from mother activity. Now i want to create tabs in this fragment. But tabHost.setup() method showing error. I don't get it so need a clue about error. // FragmentOne.java package com.example.sharelocationui; import android.app.Fragment; import android.os.Bundle; import android.support.v4.app.FragmentTabHost; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebView.FindListener; import android.widget

TabWidget not stable at the bottom in Android? Why?

一个人想着一个人 提交于 2020-01-01 16:33:15
问题 I set my tabWidget at the bottom. When i want to edit the edittext the keyboard will raise up. But the tab widget come above the keyboard. To support for the multiple screen i set the android:layout_weight="1.0". After that, I got this problem i added my layout code below. any idea to make the TabWidget at the bottom stably? Code: <?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=

Styling Tab Widget's using XML

妖精的绣舞 提交于 2020-01-01 16:09:28
问题 So I am having great difficultly styling tab widgets using xml. Everywhere I have searched seem's to either suggest solutions to do this programmatically, or refers to the actionBarTab style >:| What I am trying to achieve is a customised tab from the tabwidget drawables that was generated using http://android-holo-colors.com/ I manage to get the So in my custom theme I have this code: <style name="RR.App.Theme" parent="android:Theme.Holo.Light"> ... <item name="android:tabWidgetStyle">@style

How to show unread notification counter on Tabs inside TabLayout?

不想你离开。 提交于 2020-01-01 05:33:08
问题 I am using TabLayout of android support design library. I want to show unread notification counter on the tab with title like below image. How to set unread count on Tab inside TabLayout ? 回答1: Use public TabLayout.Tab setCustomView (int layoutResId) Create a Layout with TextView and Button use this in Custom view. For reference setCustomView Example Hope this will helpful to you. 回答2: Take a look at android-viewbadger... 来源: https://stackoverflow.com/questions/32269517/how-to-show-unread

Android Scrollable Tabs + Swipe state when swiping

狂风中的少年 提交于 2020-01-01 03:45:11
问题 I'm trying to make an application with multiple Tabs. For each tab I'm using different fragments. And when I leaf through tabs the information in them is changing. How can I save the state of each tab when swiping? Code for example: MainActivity.java : package com.tabs.example; import java.util.Locale; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager;