我在片段中使用TabPageIndicator,有时文本会被截断。这有可能以某种方式调整吗?在下面的例子中,完整的标题是“역사/문화/종교”,但它只显示“역사/문화/”。在本地化应用程序时,这会发生在整个应用程序的各个选项卡上。
XML
<com.viewpagerindicator.TabPageIndicator
android:id="@+id/indicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/roundcorner"/>
JAVA
public class SearchResultActivity extends FragmentActivity {
private TabPageIndicator indicator;
private ViewPager pager;
String mCity;
private static final String[] tabTitle = new String[] {"쇼핑", "역사/문화/종교", "자연/휴양", "전망", "오락시설"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
mCity = intent.getExtras().getString("mCity");
setContentView(R.layout.activity_search_result);
MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager());
indicator = (TabPageIndicator)findViewById(R.id.indicator);
pager = (ViewPager)findViewById(R.id.pager);
pager.setBackgroundResource(R.drawable.img_bg_background);
pager.setAdapter(adapter);
indicator.setViewPager(pager);
}
class MyPagerAdapter extends FragmentPagerAdapter {
public MyPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return SearchResultFragment.newInstance(tabTitle[position % tabTitle.length], mCity);
}
@Override
public CharSequence getPageTitle(int position) {
return tabTitle[position % tabTitle.length].toUpperCase();
}
@Override
public int getCount() {
return tabTitle.length;
}
}}