我正在做一个翻转卡应用程序,其中我在框架布局上应用了onTouchListener。通过使用singletap gesturelistener我是从前向后翻牌,反之亦然。每件事情都很好。由于我的数据很大,我必须在我的虚拟布局中引入滚动视图。在framelayout上触摸侦听器并在充气布局问题上滚动查看
setContentView(R.layout.flashframe);
cardView = (FrameLayout)findViewById(R.id.container);
cardView.setOnTouchListener(this);
mGestureDetector=new GestureDetector(this.getBaseContext(), new MyGestureListener(this));
if(savedInstanceState==null){
getFragmentManager().beginTransaction()
.add(R.id.container, new CardFrontFragment()).commit();
cardNumber=1;
setCard(cardNumber);
}
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
mGestureDetector.onTouchEvent(event);
return true;
}
public class MyGestureListener extends GestureDetector.SimpleOnGestureListener {
public MyGestureListener(OpenClass openClass) {
// TODO Auto-generated constructor stub
}
@Override
public boolean onSingleTapUp(MotionEvent me)
{
flipCard();
return true;
}
}
XML布局: -
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:weightSum="100" android:layout_height="match_parent">
<ScrollView android:layout_weight="30" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:text="To be retrieved from sqlite"
android:layout_width="match_parent" android:layout_height="match_parent"></TextView>
</ScrollView>
</LinearLayout>
框架布局: -
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
当我夸大我的滚动视图布局,手势听者没有响应,而滚动视图工作前卡。我无法翻转,如果我使用滚动视图。
请帮助我,我怎么能解决这个..
发布您的布局xml – CAS
@Chadi Abou Sleiman - 我发布了我的XML布局。 – nani
你的框架布局在哪里? – CAS