In meinem ViewPager gab es ein ImageButton und TextView von LinearLayout, und jetzt ändere ich sie in ein TextView mit coupound-Zeichen.kann nicht durch den ViewPager scrollen, wenn TextView (mit android: gravity = "center") darin berührt wird
<?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>
Meine Frage ist: Ich kann nicht nach links oder rechts Flip, wenn das Textview zu berühren, aber wenn entfernt „android: Schwerkraft =“ center“, es funktioniert ... leider wird der Text ohnehin nicht zentriert .. .?
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);
}
}
Was ist hier passiert vielen dank
Ein interessanter Fehler, die ich accross kommen. Vielen Dank. Ich habe Ihnen eine Stimme gegeben. – tasomaniac
Nur das selbe Problem, Gefunden die Antwort [hier] (http://stackoverflow.com/questions/15470755/textview-inside-viewpager-intercepts-touch-events) – darktiny