2011-02-16 6 views
0

나는 가로 이미지 목록을 가지고있다. 이미지를 길게 누르고 이미지를 드래그하려고하면 ...길게 누르는 경우 가로 스크롤을 멈추는 방법

+0

불완전한 질문에 ...... 쓰지 않는 완전 질문. 또는 귀하의 질문에 명확해야합니다 – Nikki

+0

귀하의 질문에 불완전하고 이해할 수없는에 국경. 수정을 고려하십시오. –

답변

0

갤러리 클래스를 확장하고 onLongPress (MotionEvent e) 메서드를 재정의하면 xml 위치에 갤러리 뷰를 배치하는 위치가 대신 클래스. 다음

package com.prac; 

import android.content.Context; 
import android.util.AttributeSet; 
import android.view.MotionEvent; 
import android.widget.Gallery; 
import android.widget.Toast; 

public class MyGallery extends Gallery { 


private Context mContext; 

public MyGallery(Context context) { 
    super(context); 
    mContext = context; 
    // TODO Auto-generated constructor stub 
} 

public MyGallery(Context context, AttributeSet attrs, int defStyle) { 
    super(context, attrs, defStyle); 
    mContext = context; 
    // TODO Auto-generated constructor stub 
} 

public MyGallery(Context context, AttributeSet attrs) { 
    super(context, attrs); 
    mContext = context; 
    // TODO Auto-generated constructor stub 
} 



@Override 
public boolean onLongPress(MotionEvent e) 
     { 
      // do what ever you want on Long Press Here 
    return false; 
    } 

} 

처럼

는 이제 XML 레이아웃은 희망이 도움 :) 그리고 도움이된다면 당신이 밖으로 화살표를 클릭하여 답변을 받아 들일 것을 잊지 말아이

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 

<com.prac.MyGallery 
android:id="@+id/Gallery" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
/> 



</RelativeLayout> 

같이해야한다 대답의 좌측에 녹색으로한다

관련 문제