W moim ViewPagerze było przechowywanie ImageButton i TextView przez LinearLayout, a teraz zmienię je na jeden TextView z możliwością losowania.nie można przewinąć do ViewPagera podczas dotykania TextView (z androidem: gravity = "center") w nim
<?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>
Moje pytanie brzmi: nie mogę odwracanie Gdy dotyka TextView lewo lub w prawo, ale jeśli usunięte „android: grawitacja =” center”, to działa ... niestety, nie w każdym razie tekst jest wyśrodkowany .. .?
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);
}
}
Co tu się stało dziękuję
Ciekawym bug że ja się spotkałem. Dziękuję Ci. Oddałem głos. – tasomaniac
Po prostu ten sam problem, Znalazłem odpowiedź [tutaj] (http://stackoverflow.com/questions/15470755/textview-inside-viewpager-intercepts-touch-events) – darktiny