मेरे व्यूपेजर में, एक छविबटन और टेक्स्टव्यू लिनियरलाउट द्वारा आयोजित किया गया था, और अब मैं उन्हें कूपउंड ड्रॉइंग के साथ एक टेक्स्ट व्यू में बदलता हूं।टेक्स्टव्यू को स्पर्श करते समय ViewPager को स्क्रॉल नहीं कर सकता है (एंड्रॉइड: गुरुत्वाकर्षण = "केंद्र" के साथ)
<?xml version="1.0" encoding="utf-8"?>
<com.iclinux.android.custom_views.NoScrollTextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:iclinux="http://schemas.android.com/apk/res-auto"
android:clipChildren="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:gravity="center"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:drawableTop="@drawable/icon_bg"
style="@style/EllipsizedSingleLineTextView"
android:textSize="@dimen/grid_item_title_size"
>
</com.iclinux.android.custom_views.NoScrollTextView>
मेरा प्रश्न है: मैं छोड़ नहीं कर सकते फ्लिप या सही जब TextView छू, लेकिन अगर हटा दिया "एंड्रॉयड: गुरुत्वाकर्षण =" केन्द्र ", यह काम करता है ... दुर्भाग्य से, पाठ वैसे भी केंद्रित नहीं है .. ।?
public class NoScrollTextView extends TextView {
public NoScrollTextView(Context context) {
super(context);
}
public NoScrollTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NoScrollTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_MOVE)
return false;
return super.onTouchEvent(event);
}
}
यहाँ क्या हुआ बहुत बहुत शुक्रिया
एक दिलचस्प बग कि मैं करवाते हैं आते हैं। धन्यवाद। मैंने आपको एक वोट दिया। – tasomaniac
बस एक ही समस्या, जवाब मिला [यहां] (http://stackoverflow.com/questions/15470755/textview-inside-viewpager-intercepts-touch-events) – darktiny