मुझे ViewPager के साथ एक और समस्या आई है और मैं अभी इसे अपने वर्तमान ज्ञान के साथ हल नहीं कर सकता।एंड्रॉइड टैबपेज संकेतक सामग्री रैपिंग समस्या
मेरे पास ViewPager के साथ TabPageIndicator है और प्रत्येक टैब पर, मैं टेक्स्ट दिखा रहा हूं। यह सरल TextView है:
<?xml version="1.0" encoding="utf-8"?>
<view xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="viewpagerindicator.TabPageIndicator$TabView" >
<TextView
android:id="@+id/vpi_tab_text"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:singleLine="true"
android:ellipsize="marquee"
android:gravity="center"
android:paddingBottom="10dip"
android:paddingLeft="8dip"
android:paddingRight="8dip"
android:paddingTop="10dip"
android:textColor="@drawable/vpi_tab_text_color"
android:typeface="serif" />
</view>
मैं टैब में पाठ हमेशा एक ही पंक्ति होने के लिए और हमेशा पूरे पाठ, लपटने नहीं, कोई रैपिंग, से अधिक नहीं 1 लाइन करना चाहते हैं। उपयोगकर्ता के लिए इसे पूरी तरह से पढ़ने में सक्षम होना आवश्यक है ...
लेकिन मैं ऐसा नहीं कर सकता, मैंने अलग-अलग विकल्पों की कोशिश की है और मुझे अभी भी कुछ समस्याएं आ रही हैं - या तो पाठ केवल एक पंक्ति से अधिक है, लेकिन केवल पहला प्रदर्शित होता है, या पाठ का केवल एक हिस्सा प्रदर्शित होता है।
क्या आपने कुछ ऐसा अनुभव किया है? ,
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
final boolean lockedExpanded = widthMode == MeasureSpec.EXACTLY;
setFillViewport(lockedExpanded);
final int childCount = mTabLayout.getChildCount();
if (childCount > 1 && (widthMode == MeasureSpec.EXACTLY || widthMode == MeasureSpec.AT_MOST)) {
if (childCount > 2) {
mMaxTabWidth = (int) (MeasureSpec.getSize(widthMeasureSpec) * 0.4f);
} else {
mMaxTabWidth = MeasureSpec.getSize(widthMeasureSpec)/2;
}
} else {
mMaxTabWidth = -1;
}
final int oldWidth = getMeasuredWidth();
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
final int newWidth = getMeasuredWidth();
if (lockedExpanded && oldWidth != newWidth) {
// Recenter the tab display if we're at a new (scrollable) size.
setCurrentItem(mSelectedTabIndex);
}
}
mMaxTabWidth ...
मैं इस कोशिश की, लेकिन यह – Shehabix