gpt4 book ai didi

android - PagerTabStrip 中的文本未在第一个 View 中显示

转载 作者:可可西里 更新时间:2023-11-01 18:59:31 28 4
gpt4 key购买 nike

我有以下简单设置:

swipeable.xml

<LinearLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<include layout="@layout/toolbar" />

<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<android.support.v4.view.PagerTabStrip
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.v4.view.ViewPager>
</LinearLayout>

Activity :

public class InfoActivity extends ActionBarActivity {

private static final int[][] KEYS = { { R.string.usage, R.string.usage_text },
{ R.string.data_protection, R.string.data_protection_text },
{ R.string.impressum, R.string.impressum_text } };

@Override
protected void onCreate( Bundle savedInstanceState ) {
setContentView( R.layout.swipeable );
super.onCreate( savedInstanceState );
ViewPager viewPager = (ViewPager)findViewById( R.id.pager );
viewPager.setAdapter( new SwipeAdapter( getSupportFragmentManager() ) );
}

class SwipeAdapter extends FragmentStatePagerAdapter {

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

@Override
public Fragment getItem( int position ) {
Bundle b = new Bundle();
b.putInt( "key", KEYS[ position ][ 1 ] );
return Fragment.instantiate( InfoActivity.this, InfoFragment.class.getName(), b );
}

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

@Override
public CharSequence getPageTitle( int position ) {
return getString( KEYS[ position ][ 0 ] ).toUpperCase();
}
}
}

如果我第一次访问该 Activity ,则不会显示任何 pagerstrip-texts。如果我滑动或单击选项卡,文本会正常显示:

enter image description here

这种奇怪行为的原因可能是什么?

最佳答案

对我来说,这个问题发生在我更新了 support-v13(或 v4)、appcompat-v7recyclerview- v7design 库到 23.0.0。我想这是一个错误。将其降级到 22.2.1 后,它工作正常。

我建议等到他们发布这些库的新版本。

更新:此问题仅发生在 appcompat-v7design 库中,现在已在 23.1 中修复。 0 Android 支持库的修订版。

关于android - PagerTabStrip 中的文本未在第一个 View 中显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32168726/

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