FAQ Database Discussion Community


Remove Spacing or Padding below Android Tabbed Activity (Action Bar Tabs)

android,android-layout,android-fragments,android-actionbar,android-tabhost
I just created a default "Tabbed Activity - Action Bar Tabs (with ViewPager)" using AndroidStudio My Question is that - how do I remove the Spacing/Padding on the top while scrolling, but keep the Spacing/Padding at the begining. Thank You fragment_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"...

Unable to alter the background color of the Tabhost in android

android,android-tabhost
Recently, I made a simple application that utilizes a Tabhost. However, I'm unable to set the color to it . I've set the sample code below. How will I be able to add colors to the current code ? it would be a great help if I can recieve a...

My tabhost is not working

android,android-tabhost
I am working with the tabhost with 2 tabs i am unable nothing in the tab activity, This is the main class where i implemented the tab host tabHost = getTabHost(); //* TabHost Implementations*//* tabHost = (TabHost) findViewById(android.R.id.tabhost); tabHost.setup(); TabSpec tab1 = tabHost.newTabSpec("FirstTab"); TabSpec tab2 = tabHost.newTabSpec("SecondTab"); // Set the...

Android TabActivity with Toolbar - setSupportActionBar() unknow

android,android-tabhost,android-toolbar,android-tabactivity
Is it possible to use setSupportActionBar() in an TabActivity? Extending with AppCompatActivity is not possible... public class TabHost extends TabActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tabhost); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // this is unkown getSupportActionBar().setDisplayHomeAsUpEnabled(true); //also Do I have to switch from TabActivity to FragmentTabHost? Thanks...

TabHost bar is above the keyboard when input data in android

android,android-layout,android-fragments,keyboard,android-tabhost
In my app I use the tabhost to create a menu bar like this: <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <FrameLayout android:id="@android:id/tabcontent" android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="0" /> <FrameLayout android:id="@+id/realtabcontent" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> <TabWidget...

TabHost displays content once (onCreate)

java,android,fragment,navigation-drawer,android-tabhost
I have a TabHost Inside a navigationDrawer and I'm facing this weird problem which occurs when ever i go from TabHost which exist as a navigation drawer item to another navigation drawer item and get back to TabHost it won't display its content, the first time it works perfectly but...

Tab inside android Activity

android,tabs,android-tabhost
I need tab like above picture.if i choose Address it should show existing address tab.if i choose New Address it should show address form .but tabs should be in particular area of the activity.Is this possible in android?...

Android use FragmentActivity instead of TabActivity

android,android-fragments,android-activity,android-tabhost,android-fragmentactivity
I want to change TabActivity to FragmentActivity because TabActivity is deprecated. My code is public class Fragment_Activity extends TabActivity implements TabHost.OnTabChangeListener { /** Called when the activity is first created. */ TabHost tabHost; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_tabs); // Get TabHost Refference tabHost = getTabHost(); // Set...

Android: NavigationDrawer vs. Tabbed Bar

android,android-tabhost,navigation-drawer
I'm developing an android app and i want to ask from a user-friendly perspective: Using NavigationDrawer or Using Tabbed View (TabHost i think) Which one is more user-friendly. Note: I'm not an android user....

android : tabhost not rendering tabs

java,android,android-tabhost
I have a simple activity public class MainActivity extends Activity { private TabHost tabHost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tabHost = (TabHost)findViewById(R.id.tabHost); tabHost.setup(); tabHost.newTabSpec("a"); tabHost.newTabSpec("b"); tabHost.newTabSpec("c"); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is...

create custom android tabs

android,android-layout,android-tabhost,android-tabs
I want create my own tabs and I want to have my own layout Let's say I want this result exactly But the original tab looks like Is there a way to create my own tab layout?...

Android Studio - getChildFragmentManager / android-support-v4

fragment,android-tabhost,navigation-drawer,android-support-library
I cannot solve the problem with android-support-v4. All "Extras" including "Android Support Repository (11)" and "Android Support Library (21.0.3)" - Installed. I was trying a lot of ideas which I found, but nothing help. I am AndroidStudio beginner. Here is my builg.gradle: apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion...

Unexpected cast to TabHost: Layout tag was Linear Layout

android,android-layout,android-tabhost
I try to create a tabHost as in the following code. TabHost tabs = (TabHost) findViewById(R.id.homeTabs); tabs.setup(); // Search TabHost.TabSpec tabSearch = tabs.newTabSpec("search"); tabSearch.setContent(R.id.tabSearch); tabSearch.setIndicator("Search"); tabs.addTab(tabSearch); // Notification TabHost.TabSpec tabNotification = tabs.newTabSpec("notification"); tabNotification.setContent(R.id.tabNotification); tabNotification.setIndicator("Notification"); tabs.addTab(tabNotification); and its xml code is <TabHost...

FragmentTabHost - No tab known for tag null

java,android,android-layout,android-viewpager,android-tabhost
Few days ago I implemented TabHostFramgent in a Fragment with a NavigationDrawer, and I faced with a problem that is the following error : java.lang.IllegalStateException: No tab known for tag null The thing is that all works perfectly since my first item list of my NavigationDrawer is my TabHostFragment, so...

Placing Tabs in DialogFragment

android,android-tabhost,android-dialogfragment
I am attempting to place TabHost inside of DialogFragment but at present it is none functional and returns null on the line: tabs.findViewById(R.id.tabHost); How can tabhost be initialized in the DialogFragment to allow the tabs to appear? Tabbed DialogLog class: public class InviteFriendTabbedAlertDialog extends DialogFragment { TabHost tabs; @Override public...

Android Viewpager display wrong data on first load

android,android-fragments,tabs,android-viewpager,android-tabhost
/**i'm using android.support.v4.view.ViewPager with tabhost for show a tab data, i have 3 tab when first time it is load 1st tab is load 3rd tab data ...3rd tab is load 1st tab data .and 2nd tab is correctly loads own data My Code For viewpager and tabhost is Thx...

How to highlight a Tab when Notification received

java,android,android-tabhost,android-notifications
I have implemented Tab host with the Notification. Now My problem is: there are 3 tabs like Food, Health and Service. If i receive a Food Notification How to highlight the Food Tab automatically

How to change shapedrawable color dynamically for TabHost background?

android,android-layout,android-tabhost,drawable,shape
I have a TabHost, where I use a shape xml to make it looks like this: I define the TabHost background this way: private void setTabColor(TabHost tabHost) { try { for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) { tabHost.getTabWidget().getChildAt(i).setBackgroundResource(R.drawable.strib_tab); } } catch (ClassCastException e) { } } where...

How to create app bar with icons using TabLayout Android Design?

android-tabhost,android-tabs,android-design-library
I'm trying to use the new TabLayout in the android design library to create app bar with icons. public void setupTabLayout(TabLayout tabLayout) { tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER); tabLayout.setupWithViewPager(mViewpager); tabLayout.getTabAt(0).setIcon(R.drawable.ic_tabbar_library); tabLayout.getTabAt(1).setIcon(R.drawable.ic_tabbar_recents); tabLayout.getTabAt(2).setIcon(R.drawable.ic_tabbar_favorites);...

How to pass data between multiple Fragments in Android

android,android-tabhost,android-listfragment,android-dialogfragment,dialogfragment
In my main Activity, I have a DialogFragment that contains a FragmentTabHost. I have two tabs, one that is a DialogFragment and one that is a ListFragment. When either the 'OK' button is pressed in the inner DialogFragment or when an element in the ListFragment is pressed, I want to...

Sliding menu Android

android,menu,fragment,android-tabhost,sliding
I have an app that is using tabHost menu and I need to change it, because the menu items is growing and they don't fit in the current menu. My classes are extending FragmentActivity, I want to know if is possible to use Sliding Menu with them or I will...

onActivityResult not call in the Fragment

android,android-activity,android-fragments,android-tabhost,onactivityresult
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):...

Changing color of TabHost/TabWidget

java,android,colors,android-tabhost,tabwidget
I'm having a really hard time changing the color of my TabWidget. I've looked at several posts and tried them out, but none of them worked for me. I'm trying to change the default (blue) color scene to green. Image of my app My xml code: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"...

Tabhost error in getting in to my activity

android,android-tabhost
When I am trying to get the tab host in my activity it is showing the error that do you forget to call public void setup(LocalActivityManager activityGroup)? public class MainActivity extends FragmentActivity { private Resources res; private TabHost tabHost; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // tabHost =...

Half-screen TabHost

android,android-tabhost,viewflipper
how can I display a Tabhost in the bottom half of the screen, displaying a static picture (can under no circumstances be reloaded/redisplayed each time you swipe). +--------------------------+---+---+ | = | * | ? | < Action Bar with Help, Settings and +--------------------------+---+---+ a sliding drawer from the left |...

tabhost along with tabs goes when navigation drawer pulled

android,android-viewpager,android-tabhost,navigation-drawer
I have a navigation drawer with swipe views and tab navigation. My problem is that when navigation drawer is pulled tabs are gone and when i swipe project stops unexpectedly. Below is the logcat here is where studio points the error. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) {...

Cannot resolve constructor Intent

android,android-intent,android-tabhost
Im trying to add a tabhost to my application but i cant figure why this error 'cannot resolve constructor intent' is showing, here's my activity code: public class SixthFragment extends Fragment { public static final String TAG = "sixth"; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)...