gpt4 book ai didi

android - 滑动 TabLayout 底部填充

转载 作者:太空宇宙 更新时间:2023-11-03 12:17:53 25 4
gpt4 key购买 nike

我面临的问题是我的 SlidingTabLayout 中有一种填充。

这是截图 enter image description here

如您所见,背景来自底部的 slider 。最近,使用 pagertabstrip 库,我没有看到,但现在我尝试了新的 com.example.android.common.view.SlidingTabLayout 它肯定在那里。如何删除此填充?

谢谢

hiere 是 xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.example.android.common.view.SlidingTabLayout
android:id="@+id/lib_tabs"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@android:color/holo_green_light"
/>

<android.support.v4.view.ViewPager
android:id="@+id/lib_pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>

风格

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/my_action_bar_color</item>
</style>

<style name="ToolBarStyle" parent="">
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
<item name="theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>

</style>

fragment

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.lib_tabs, null);

mViewPager = (ViewPager) view.findViewById(R.id.lib_pager);
mViewPager.setAdapter(new CustomPagerAdapter(this.getFragmentManager()));

mSlidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.lib_tabs);
mSlidingTabLayout.setViewPager(mViewPager);

return view;
}

public class CustomPagerAdapter extends FragmentPagerAdapter {

private final String[] TITLES = {"Categories", "Home", "Top"};

public CustomPagerAdapter(FragmentManager fm) {
super(fm);
}

@Override
public CharSequence getPageTitle(int position) {
return TITLES[position];
}

@Override
public int getCount() {
return TITLES.length;
}

@Override
public android.support.v4.app.Fragment getItem(int position) {
return LibSimpleInstanceableFragment.newInstance();
}
}

最佳答案

distributeEvenlytrue 时会发生这种情况。随便评论

lp.width = 0;

SlidingTabLayout.java类的populateTabStrip()方法中,你的问题就解决了。

关于android - 滑动 TabLayout 底部填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28340870/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com