一個片段有兩個視圖一個FrameLayout包含一些子視圖,在FrameLayout下面有一個viewPager。 我想更換片段時有一個像ACTION_MOVE上的FrameLayout的動作,讓我上的FrameLayout添加onTouchListener但它從來沒有工作,viewPager效果很好,也是FrameLayout裏的孩子們的觀點具有onClick事件FrameLayout上面的viewPager片段中的onTouch事件攔截了bean
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.hall_gift, container,
false);
frameLayout = (FrameLayout)view.findViewById(R.id.fans_body_title);
frameLayout.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction()==MotionEvent.ACTION_DOWN){
Log.i(TAG,"ACTION DOWN");
}
return false;
}
});
return view;
}
由「framlayout」 ,你的意思是'FrameLayout',對吧? – APerson 2014-09-25 02:18:08
是的!抱歉拼寫錯誤! – Sunday 2014-09-25 02:27:36
張貼您的代碼請 – mmlooloo 2014-09-25 02:33:08