android-tablayout

Android: How to change android:fillcolor with selector in one Vector Drawable xml

≯℡__Kan透↙ 提交于 2019-12-12 07:27:29
问题 Tab Icons: My current method is to create two files (ic_list_selected_24dp.xml and ic_list_unselected_24dp.xml; they are basically the same but only the android:fillColor='Color HEX CODE' are different), and then create a selector (selector_tabitem_list.xml) to change the drawable color when the state is changed. // @drawable/selector_tabitem_list.xml <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android

Show DialogFragment over TabLayout

与世无争的帅哥 提交于 2019-12-12 06:11:20
问题 I'm trying to show a DialogFragment full-screen such that the ActionBar is still visible but the tabs in a TabLayout are hidden. The image on the left is what I've managed to achieve; the image on the right is what I'm aiming for: There are two issues: The tabs are still shown, which the user can interact with; Because of the extra FrameLayout to show the dialog, the ViewPager content is still visible (the FAB button is not part of the dialog). This also means that the user can interact with

setUserVisibleHint() throwing NullPointerException when calling getActivity()

假装没事ソ 提交于 2019-12-12 05:49:39
问题 I have create 3 Fragments which are in a ViewPager. I am trying to get data from the server only when the particular Fragment is visible to the user. For that I have called my web service method in setUserVisibleHint(). But I am get NullPointerException when I am using getActivity() inside that method. How can I make sure I that I load data only once and when its visible to the user ? Here the code: @Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint

Android: TabLayout indocator hanging between tabs

时光怂恿深爱的人放手 提交于 2019-12-12 05:44:12
问题 I'm using android support library (23.1.1) to create a tab layout. I followed the tutorial here, it uses AppCompatActivity. The problem is that the indicator of the TabLayout is handing between the two tabs and not moving smoothly when swiping. When searching for a solution I found similar problem that the indicator bounces between tabs, and its solution was to use newer version of the library. I'm using the latest version and facing this problem. 回答1: Get the SlidingTabStrip file here -

Weird tab behavior, what's wrong with the adapter

天涯浪子 提交于 2019-12-12 04:29:26
问题 My tabLayout is exhibiting this strange behaviour You can see that by swiping the tabs after clicking a row the content from a tab gets mixed with the content from another. Each row in the listView (the gif only shows one row, of course there'd be more) can be clicked to update a value from the database on which the eye icon is based. So, I want the icon to update at the same time. In the activity source file I also declared the PagerAdapter for the fragment tabs, the fragment and the

Launching new fragment from fragment in tab layout doesn't hide the tabs

送分小仙女□ 提交于 2019-12-12 04:05:46
问题 So I have implemented Tab layout with ViewPager in my app. Each tab shows a fragment. Now I want to open a new fragment(lets call it B) from one of these fragments in the tab layout(lets call it A). So A is in tab layout but I want B to take up whole screen. I am even able to do it but I am facing little problem. The new fragment doesn't take up the whole screen. Instead it just replaces the previous fragment, and it looks like it was a part of the tab layout. This is the layout of the

able to open the app in Emulator, but unable to start the activity for Google Signin

那年仲夏 提交于 2019-12-12 03:53:53
问题 MainActivity.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initializeControls(); loginWithFB(); toolbar = (Toolbar) findViewById(R.id.toolbar); viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); View inflatedView = getLayoutInflater().inflate(R.layout.fragment_login_social, null

Regarding loading items to the spinner using volley library

霸气de小男生 提交于 2019-12-12 03:00:56
问题 I am trying to load items to the spinner inside my MainActivity toolbar.Inside MainActivity there is a fragment called HomeFragment . And that fragment contains SlidingTabLayout and once I click different tabs I need to load different data sets to the above mentioned spinner. Here is how it looks like : I have implemented method inside MainActivity to add data to the spinner : public void addItemsToSpinner(final Collection<String> collection) { ArrayList<String> list = new ArrayList<>(); list

Why does TabLayout leave a gap for the NavBar when in immersive mode?

陌路散爱 提交于 2019-12-12 02:45:11
问题 I'm making a tabbed app using the Tabbed Activity template in Android Studio. The client wants the tabs at the bottom and it's for use in a kiosk so I have enables immersive mode etc just fine. My draft layout looks like this: <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:layout_width="match

How to detect a click on every single tab in tablayout?

为君一笑 提交于 2019-12-12 02:38:28
问题 I have a viewpager with undetermined pages, because the user can add pages too. Thats okay, but I have no idea how to make it possible, that my user could delete those pages. I have tried to implement a long click listener on every tab with the code below, but it is not working. Then how to detect which one tab is clicked? for (tabCounter = 0; tabCounter < DataOfPages.size(); tabCounter++) { tabLayout.getTabAt(tabCounter).setOnLongClickListener(new View.OnLongClickListener() { @Override