android-tablayout

How to properly use Fragments inside TabLayout with MvvmCross 6.x

无人久伴 提交于 2020-01-04 15:51:07
问题 Problem I'm trying to make a very simple Proof of Concept with TabLayout and Fragments using MvvmCross 6.1.2. For this, I implemented an activity with a TabLayout and a ViewPager, which should have two tabs - each one containing a different fragment with just one TextView. But I'm receiving an exception followed by a crash on runtime, when this activity should be displayed: The type MvxTabLayoutPresentationAttribute is not configured in the presenter dictionary Code This is what my code looks

Different sized tabs with TabLayout android

左心房为你撑大大i 提交于 2020-01-02 19:32:29
问题 Trying to recreate same top TabLayout as Instagram. Main tab: Side tabs: Have tried multiple things: app:tabMode="fixed" app:tabMode="scrollable" I managed to create this programmatically like so: View view1 = getLayoutInflater().inflate(R.layout.customtab, null); view1.findViewById(R.id.icon).setBackgroundResource(R.drawable.my1); tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); View view2 = getLayoutInflater().inflate(R.layout.customtab, null); view2.findViewById(R.id.icon)

Failed to Load fragments when tabs + viewpager inside scrollview ?

…衆ロ難τιáo~ 提交于 2020-01-02 04:20:28
问题 using material design tablayout +viewpager material design tablayout everything works perfectly but if i m trying to put parent view as ScrollView so that my whole screen can scroll once user try to see tabs fragment content as fragment contains listview so it is getting very low height on small devices.After adding scrollview my fragments of viewpager are not being displayed ?how to overcome in this situation ? <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas

TabLayout Indicator customization

筅森魡賤 提交于 2020-01-01 11:46:06
问题 i have been searching how to change the indicator in Tablayout to be circular, like this but i don't know how to do so, any help! 回答1: From the source code, the tab indicator is defined as: <style name="Base.Widget.Design.TabLayout" parent="android:Widget"> <item name="tabMaxWidth">@dimen/design_tab_max_width</item> <item name="tabIndicatorColor">?attr/colorAccent</item> <item name="tabIndicatorHeight">2dp</item> <item name="tabPaddingStart">12dp</item> <item name="tabPaddingEnd">12dp</item>

How sync TabLayout with ViewPager when using TabItem

三世轮回 提交于 2020-01-01 09:54:07
问题 I want to use TabLayout with TabItem with following code: <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/color_primary" app:tabGravity="fill" app:tabIndicatorColor="@color/white" app:tabMode="fixed" app:tabSelectedTextColor="@color/white" app:tabTextColor="@color/gray_light"> <android.support.design.widget.TabItem android:layout_width="wrap_content" android:layout_height="match

How to Intent into specific Tab Fragment?

╄→尐↘猪︶ㄣ 提交于 2020-01-01 06:30:06
问题 T have two Activities: MainActivity and LoginActivity. I have one Fragment too, the name is TabFragment (with a TabLayout), its parent is MainActivity. How can I intent into the specific TabFragment from my Login Activity. This is my Main Activity: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); id = getIntent().getStringExtra("id"); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction()

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

TabLayout scrolls to unkown position after calling notifyDataSetChanged on PagerAdapter

半腔热情 提交于 2020-01-01 04:53:10
问题 I have sample project with TabLayout and PagerAdapter . Strange things happens with TabLayout when I call pagerAdapter.notifyDataSetChanged(); after tabLayout.setupWithViewPager(viewPager); TabLayout is scrolling to unknown x position so the current tab is not visible. However if I scroll to left to expecting tab, this tab has indicator. What is going on? Could anyone help me? I have spent on it too many time. Below the code. public class MainActivity extends AppCompatActivity { @Override

Use Tab layout in MVVM architecture with the data binding library

你离开我真会死。 提交于 2019-12-31 09:45:24
问题 I am developing an app that has tab layout as the image. I’d like to use MVVM architecture with data binding library but I am new with this framework. I can do this without using MVVM by normally setup tab layout using ViewPager as this sample. Normal tab layout without MVVM and data binding: activity_main.xml: <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width=

Got Error inflating class android.support.design.widget.TabLayout

前提是你 提交于 2019-12-31 01:29:09
问题 I'm trying to create a menu tab based on Google's "material design" using Eclipse, but I got an error: 01-07 01:02:10.238: E/tag(6696): contact on create called 01-07 01:02:10.301: E/AndroidRuntime(6696): FATAL EXCEPTION: main 01-07 01:02:10.301: E/AndroidRuntime(6696): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rvappsstudios.designflashalerts/com.rvappsstudios.designflashalerts.MainActivity}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com