android-tabs

How to build an app with Actionbar ,Tab support and MapView

点点圈 提交于 2019-12-04 21:52:04
I am building an app which looks something like this. It has a action bar and Tabs as shown below. Tab 1: Should display images with ViewPage and indicator. Tab 2: Should display maps. I am new to android, but still somehow managed to build an app using internet resources and with the help of samples source. But i got stuck near mapview (when click on Tab2). I used TabHost, but this dint work, later on came to know that google has released new API supporting Map fragments. I even used Google API for MapFragment(the new one) but what i ended up with was some junk code. I messed up everything. I

Creating Tabs inside Fragment

≡放荡痞女 提交于 2019-12-04 20:40:40
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.ImageView; import android.widget.TextView; import android.widget.TabHost; public class FragmentOne extends

How to create new LinkedIn app style ActionBar with Tabs inside it?

↘锁芯ラ 提交于 2019-12-04 18:28:54
I'm trying to create an ActionBar with 5 tabs and a button/imageview that will open NavigationDrawer from the right side. Very similar to what LinkedIn have done in their new Android application, here is an image: I tried two methods, but non of them went well for me: I tried to created a new TabbedActivity project, the resulted layout included this: <android.support.design.widget.CoordinatorLayout android:id="@+id/main_content" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools android

Android TabHost Center active Tab

两盒软妹~` 提交于 2019-12-04 17:13:27
Is it possible to change Android Tabs that if you press one, it comes to the center of the TabHost. Only 3 Tabs are visible, doesn't matter how many there are. Like in the Android 4.0 Google Music App! If it is, how would you do that? Thank you! I did find the answer myself. If somebody else needs it, this should do it: final HorizontalScrollView mHorizontalScrollView; float scale = getResources().getDisplayMetrics().density; final double tabWidth = (int) (150 * scale + 0.5f); for (int i = 0; i < tabHost.getTabWidget().getTabCount(); i++) { tabHost.getTabWidget().getChildTabViewAt(i)

Is TabLayout supposed to replace PagerTabStrip? Is there any “pro” to PagerTabStrip?

☆樱花仙子☆ 提交于 2019-12-04 16:31:29
OK, so I see PagerTabStrip has a bug - https://code.google.com/p/android/issues/detail?id=183127 Therefore, is TabLayout a better choice especially for now? Is there any downside to TabLayout? Some quirkiness where you might have to set all 3 items? I see TabLayout versus pagerTabStrip for convenience and functionality but that didn't really get answers... 来源: https://stackoverflow.com/questions/32770917/is-tablayout-supposed-to-replace-pagertabstrip-is-there-any-pro-to-pagertabst

How to show different layouts in each Tab in a TabLayout using Fragments

不羁岁月 提交于 2019-12-04 16:25:20
I have been trying to show different layouts in different tabs in the swipeable TabLayout using PagerTabStrip. Can anybody help? I want to show one layout in first tab, second different layout in 2nd tab etc. public class MainActivity extends FragmentActivity { // create object of FragmentPagerAdapter SectionsPagerAdapter mSectionsPagerAdapter; // viewpager to display pages ViewPager mViewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Create the adapter that will return a fragment for each of

How to scroll tablayout programmatically - Android

a 夏天 提交于 2019-12-04 15:42:22
问题 I have created 30 scrollable tabs using tablayout. So first three tabs are visible on screen and rest of them are invisible which can be scroll using swipe gesture. The problem is when I am selecting last tab programmatically but it is not get visible (tab layout not get scrolled to last tab). How can I make tablayout to scroll to last tab? 回答1: I found the solution. First I had found the width of tablayout and scroll it's x position to width and than called the select() method of last tab.

How to make tabs with webview to load from a web address?

廉价感情. 提交于 2019-12-04 14:57:36
I want to build an application in Android Studio. I have inside tabs: | tab one | tab two | tab three | ...and each tab should load a webview page. For example: tab one should load www.google.com, and tab two should load www.youtube.com, ... How can I build this? Shailender Narang Here It Is activity_main.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" /> MainActivity.java import android.app.ActionBar; import android.app.Activity; import android.app.Fragment;

How open tab in Espresso

一笑奈何 提交于 2019-12-04 13:27:42
问题 How can i open tab in Espresso test? I tried to do Espresso.onView(ViewMatchers.withId(R.id.practice_results_tab)).perform(ViewActions.click()); , but that doesn't working. In that code i opened Layout of this tab. There is the XML file: <TabHost android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/practice_tabHost"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <TabWidget android:id="

How to launch an activity with a specific tab?

耗尽温柔 提交于 2019-12-04 12:36:51
问题 I've gone through many examples, questions and tutorials but I've never seen an activity launch (launch a new intent) with a specific tab. I know that one can use .setCurrentTab to switch to a tab, but this can be done only from inside the parent activity tab. How about launching a specific tab contained in one activity from a different activity? Is it possible? If so, then how? In my code, on a standard activity launch user is shown the first tab, but I want him to go to the fourth tab in