2016-05-25 9 views
0

dies mein xml:android Drag & Drop-Funktionalität nicht in Android Objekte auf Finger-Move (Vor allem in vergrößern, verkleinern tun, um nicht-Funktion)

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
 
    android:layout_width="match_parent" 
 
    android:layout_height="match_parent" 
 
    xmlns:tools="http://schemas.android.com/tools" 
 
    android:orientation="vertical" 
 
    android:gravity="center" 
 
    > 
 

 
    <android.support.design.widget.AppBarLayout 
 
     android:layout_width="match_parent" 
 
     android:layout_height="wrap_content" 
 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
 
     app:elevation="0dp"> 
 

 
     <android.support.v7.widget.Toolbar 
 
      android:id="@+id/toolbar" 
 
      android:layout_width="match_parent" 
 
      android:layout_height="?attr/actionBarSize" 
 
      android:background="?attr/colorPrimary" 
 
      style="@style/custom_toolbar" 
 
      app:layout_scrollFlags="scroll|enterAlways" 
 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> 
 

 

 
    </android.support.design.widget.AppBarLayout> 
 

 
    <RelativeLayout 
 
     android:id="@+id/layout_title" 
 
     android:layout_width="fill_parent" 
 
     android:layout_height="wrap_content" 
 
     android:layout_alignParentTop="true" 
 
     android:background="#ffffff" /> 
 

 
    <FrameLayout 
 
     android:layout_width="fill_parent" 
 
     android:layout_height="wrap_content" 
 
     android:layout_weight="12" 
 
     > 
 
     <RelativeLayout 
 
      android:id="@+id/ec_rltabselected" 
 
      android:layout_width="fill_parent" 
 
      android:layout_height="fill_parent" 
 
      android:padding="5dp" > 
 
      <AbsoluteLayout 
 
       android:id="@+id/relative1" 
 
       android:layout_width="fill_parent" 
 
       android:layout_height="fill_parent" 
 
       android:background="@drawable/border_rounding" > 
 
       <ImageView 
 
        android:id="@+id/ivCardView" 
 
        android:layout_width="fill_parent" 
 
        android:layout_height="match_parent" /> 
 
      </AbsoluteLayout> 
 
     </RelativeLayout> 
 
     <LinearLayout 
 
      android:id="@+id/llBottomLayout" 
 
      android:layout_width="wrap_content" 
 
      android:layout_height="wrap_content" 
 
      android:layout_gravity="bottom" 
 
      android:layout_margin="5dp" 
 
      android:orientation="horizontal" 
 
      android:padding="5dp" 
 
      android:weightSum="0" > 
 
     </LinearLayout> 
 
    </FrameLayout> 
 

 
    <android.support.v7.widget.RecyclerView 
 
     android:layout_weight="1" 
 
     android:layout_marginBottom="10dp" 
 
     android:id="@+id/recyclerview_up" 
 
     android:layout_width="match_parent" 
 
     android:layout_height="150dp" 
 
     /> 
 

 

 
</LinearLayout>

Und mein Klasse:

public class clothe_codi extends AppCompatActivity { 
 

 
    private Toolbar toolbar; 
 

 
    ArrayList<String> arr_id_list; 
 

 
    Clothe_DBHelper helper; 
 
    SQLiteDatabase db; 
 

 
    List<clothe_codi_mini_item> codi; 
 
    RecyclerView recyclerView_mini_codi; 
 

 
    //경계선 
 

 
    private Button m_btnSelectImage, m_btnSDeleteImage, m_btnZoom; 
 
    private Context m_context; 
 
    private LinearLayout m_llTopLayout; 
 
    private ImageView m_ivImage, m_ivtmpImage; 
 
    private Display m_screen; 
 
    private int m_DisplayWidth, m_ImageCount, m_viewsAddedHeightEmotions = 0, 
 
      m_height, m_absHeight = 0, m_AddedViewsHeightText = 0, 
 
      m_deleteEditHeightwidth; 
 
    private Dialog m_dialog; 
 
    private View.OnTouchListener m_touchImagListener, m_strecthArrowListener; 
 
    private AbsoluteLayout m_absolutelayout, m_absTextlayout, m_absZoomlayout; 
 
    private int m_widthDelete = 0, m_totalTextViewCount = 0; 
 
    private float m_oldDist = 1f, m_scale, m_oldX = 0, m_oldY = 0, m_dX, m_dY, 
 
      m_posX, m_posY, m_prevX = 0, m_prevY = 0, m_newX, m_newY; 
 
    ViewTreeObserver m_vtoTree; 
 
    private AbsoluteLayout.LayoutParams m_layoutparams, m_layoutparamsDelete, 
 
      m_layoutParamsEdit; 
 
    private ArrayList<ViewsVo> m_arrSignObjects; 
 
    private Bitmap m_bitmap; 
 

 

 
    @Override 
 
    protected void onCreate(Bundle savedInstanceState) { 
 
     super.onCreate(savedInstanceState); 
 
     setContentView(R.layout.clothe_codi); 
 

 
     //id데리고 오기 
 
     arr_id_list = new ArrayList<String>(); 
 

 
     //db만들기 
 
     helper = new Clothe_DBHelper(getApplicationContext()); 
 
     db = helper.getWritableDatabase(); 
 

 
     toolbar = (Toolbar) findViewById(R.id.toolbar); 
 
     setSupportActionBar(toolbar); 
 
     getSupportActionBar().setDisplayHomeAsUpEnabled(true); 
 
     toolbar.setNavigationIcon(R.drawable.ref_back); 
 
     //toolbar상단에 글씨설정 
 
     setSupportActionBar(toolbar); 
 
     getSupportActionBar().setTitle("코디하기"); 
 

 
     recyclerView_mini_codi=(RecyclerView)findViewById(R.id.recyclerview_up); 
 
     LinearLayoutManager layoutManager_up=new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); 
 
     recyclerView_mini_codi.setHasFixedSize(true); 
 
     recyclerView_mini_codi.setLayoutManager(layoutManager_up); 
 
     codi=new ArrayList<>(); 
 
     //listview에 뿌려주기 위하여 
 
     ClotheSelect(); 
 
     recyclerView_mini_codi.setAdapter(new clothe_codi_mini_item_RecyclerAdapter(getApplicationContext(),codi,R.layout.activity_main)); 
 
     recyclerView_mini_codi.addOnItemTouchListener(new RecyclerViewOnItemClickListener(this, recyclerView_mini_codi, 
 
       new RecyclerViewOnItemClickListener.OnItemClickListener() { 
 
        @Override 
 
        public void onItemClick(View v, int position) { 
 
         final Integer selectedPos = position; 
 
         String popo = arr_id_list.get(selectedPos); 
 

 
         Cursor search; 
 
         search = db.rawQuery("SELECT * FROM clothe_list where _id = '" + popo + "';", null); 
 
         while (search.moveToNext()){ 
 

 
          byte[] byteimage = search.getBlob(3); 
 
          Bitmap bitmapimage = DbBitmapUtility.getBitmap(byteimage); 
 

 
          getImageLayout(bitmapimage); 
 

 
         } 
 
         search.close(); 
 

 

 
        } 
 

 
        @Override 
 
        public void onItemLongClick(View v, int position) { 
 

 

 
        } 
 
       } 
 
     )); 
 

 

 

 
     //I made Drag and Drop to Move Objects on Finger Touch in Android 
 
     m_context = clothe_codi.this; 
 
     m_ivImage = (ImageView) findViewById(R.id.ivCardView); 
 
     m_absolutelayout = (AbsoluteLayout) findViewById(R.id.relative1); 
 
     m_llTopLayout = (LinearLayout) findViewById(R.id.llBottomLayout); 
 
     m_arrSignObjects = new ArrayList<ViewsVo>(); 
 
     // Set the layout parameters to the Absolute layout for adding images. 
 
     RelativeLayout.LayoutParams rl_pr = new RelativeLayout.LayoutParams(
 
       RelativeLayout.LayoutParams.FILL_PARENT, 
 
       RelativeLayout.LayoutParams.FILL_PARENT); 
 
     rl_pr.addRule(RelativeLayout.ABOVE, R.id.llBottomLayout); 
 
     rl_pr.addRule(RelativeLayout.BELOW, R.id.layout_title); 
 
     m_absolutelayout.setLayoutParams(rl_pr); 
 
     m_screen = ((WindowManager) getSystemService(WINDOW_SERVICE)) 
 
       .getDefaultDisplay(); 
 
     m_DisplayWidth = m_screen.getWidth(); 
 
     m_AddedViewsHeightText = m_llTopLayout.getHeight(); 
 
     // Get the absoulte layout height according to the device screen density 
 
     // to set the layout. 
 
     m_vtoTree = m_absolutelayout.getViewTreeObserver(); 
 
     m_vtoTree.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { 
 
      @Override 
 
      public void onGlobalLayout() { 
 
       m_absHeight = m_absolutelayout.getHeight(); 
 
       m_absolutelayout.getViewTreeObserver() 
 
         .removeGlobalOnLayoutListener(this); 
 
      } 
 
     }); 
 
     m_dialog = new Dialog(this, R.style.Dialog); 
 
     m_dialog.setCancelable(true); 
 

 

 
    } 
 

 
    public void ClotheSelect() { 
 

 
     Cursor search; 
 
     search = db.rawQuery("SELECT * FROM clothe_list", null); 
 
     while (search.moveToNext()){ 
 
      String up_down = search.getString(1); 
 
      String clothename = search.getString(2); 
 
      byte[] byteimage = search.getBlob(3); 
 
      Bitmap bitmapimage = DbBitmapUtility.getBitmap(byteimage); 
 

 
      codi.add(new clothe_codi_mini_item(up_down, clothename, bitmapimage)); 
 

 
      //id를 저장 
 
      arr_id_list.add(search.getString(0)); 
 

 
     } 
 
     search.close(); 
 
    } 
 

 

 
    @Override 
 
    public boolean onCreateOptionsMenu(Menu menu) { 
 
     MenuInflater inflater = getMenuInflater(); 
 
     inflater.inflate(R.menu.main, menu); 
 
     return super.onCreateOptionsMenu(menu); 
 
    } 
 

 
    @Override 
 
    public boolean onOptionsItemSelected(MenuItem item) { 
 
     // TODO Auto-generated method stub 
 

 
     super.onOptionsItemSelected(item); 
 

 
     switch (item.getItemId()) { 
 
      case android.R.id.home: 
 
       // NavUtils.navigateUpFromSameTask(this) 를 사용할 경우 모든 Activity를 Destroy 시키고 부모 Activity로 돌아간다. 
 
       // NavUtils.navigateUpFromSameTask(this); 
 
       // finish() 를 사용할 경우 현재 Activity를 Destroy하고 부모 Activity로 돌아간다. 
 
       finish(); 
 
       return true; 
 
      case R.id.setting: 
 

 
       Intent timesetting = new Intent(clothe_codi.this, ref_time_setting.class); 
 
       startActivity(timesetting); 
 

 
       return true; 
 

 
     } 
 
     return super.onOptionsItemSelected(item); 
 
    } 
 
    @Override 
 
    protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
 
     super.onActivityResult(requestCode, resultCode, data); 
 
     switch (requestCode) { 
 
      case 0: 
 
       if (requestCode == 0 && resultCode == RESULT_OK && null != data) { 
 
        m_bitmap = null; 
 
        Uri selectedImage = data.getData(); 
 
        String[] filePathColumn = { MediaStore.Images.Media.DATA }; 
 
        Cursor cursor = getContentResolver().query(selectedImage,filePathColumn, null, null, null); 
 
        cursor.moveToFirst(); 
 
        int columnIndex = cursor.getColumnIndex(filePathColumn[0]); 
 
        String picturePath = cursor.getString(columnIndex); 
 
        cursor.close(); 
 
        m_bitmap = BitmapFactory.decodeFile(picturePath); 
 
        getImageLayout(m_bitmap); 
 
       } 
 
       break; 
 
     } 
 
    } 
 

 
    /** 
 
    * Method to set the view's height dynamically according to screen size. 
 
    */ 
 
    private void setViewsHeightDynamically() { 
 
     if (m_absHeight <= 500) { 
 
      m_layoutparamsDelete = new AbsoluteLayout.LayoutParams(20, 20, 110,0); 
 
      m_layoutParamsEdit = new AbsoluteLayout.LayoutParams(20, 20, 110,110); 
 
      m_deleteEditHeightwidth = 20; 
 
     } else if (m_absHeight >= 900) { 
 
      m_layoutparamsDelete = new AbsoluteLayout.LayoutParams(40, 40, 130,0); 
 
      m_layoutParamsEdit = new AbsoluteLayout.LayoutParams(40, 40, 130,130); 
 
      m_deleteEditHeightwidth = 40; 
 
     } else { 
 
      m_layoutparamsDelete = new AbsoluteLayout.LayoutParams(35, 35, 140,0); 
 
      m_layoutParamsEdit = new AbsoluteLayout.LayoutParams(35, 35, 120,120); 
 
      m_deleteEditHeightwidth = 35; 
 
     } 
 
    } 
 
    /** 
 
    * Method to add the image by setting and creating the views dynamically 
 
    * with delete and zoom option. 
 
    */ 
 
    @SuppressWarnings("deprecation") 
 
    private void getImageLayout(Bitmap p_bitmap) { 
 
     ViewsVo m_signVo; 
 
     //Check for images count .Set the count for limiting the number of images to add on screen. 
 
     if (m_ImageCount < 1) { 
 
      m_viewsAddedHeightEmotions = m_viewsAddedHeightEmotions + 90; 
 
      m_ImageCount++; 
 
     } 
 
     m_btnSDeleteImage = new Button(m_context); 
 
     m_btnZoom = new Button(m_context); 
 
     m_ivtmpImage = new ImageView(m_context); 
 
     setViewsHeightDynamically(); 
 
     m_btnSDeleteImage.setLayoutParams(m_layoutparamsDelete); 
 
     m_btnSDeleteImage.setBackgroundDrawable(getResources().getDrawable(
 
       R.drawable.ic_deletered)); 
 
     m_btnSDeleteImage.setId(0); 
 
     m_btnSDeleteImage.setOnClickListener(new ImageDeleteListener()); 
 
     m_btnZoom.setLayoutParams(m_layoutParamsEdit); 
 
     m_btnZoom.setBackgroundDrawable(getResources().getDrawable(
 
       R.drawable.right_arrow)); 
 
     m_btnZoom.setId(0); 
 
     m_absTextlayout = new AbsoluteLayout(m_context); 
 
     m_absZoomlayout = new AbsoluteLayout(m_context); 
 
     //500여기 숫자를 늘리면 이미지 자체 화질이 좋아진다. 
 
     m_ivtmpImage.setImageBitmap(Bitmap.createScaledBitmap(p_bitmap, 500, 500, true)); 
 
     m_absTextlayout.setLayoutParams(new AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT,AbsoluteLayout.LayoutParams.WRAP_CONTENT, 0, 0)); 
 
     m_absZoomlayout.setLayoutParams(new AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT,AbsoluteLayout.LayoutParams.WRAP_CONTENT, 0, 0)); 
 
     if (m_absHeight >= 900) 
 
      //setLayoutParams를 이용하여 위의 이미지 크기를 지정한다. 
 
      m_ivtmpImage.setLayoutParams(new FrameLayout.LayoutParams(100, 100)); 
 
     else 
 
      m_ivtmpImage.setLayoutParams(new FrameLayout.LayoutParams(80, 80)); 
 
     m_ivtmpImage.setBackgroundColor(Color.TRANSPARENT); 
 
     m_absTextlayout.addView(m_btnSDeleteImage); 
 
     if (m_absHeight >= 900) 
 
      m_absZoomlayout.setPadding(20, 20, 15, 15); 
 
     else 
 
      m_absZoomlayout.setPadding(15, 15, 15, 15); 
 
     /*m_absZoomlayout.setBackgroundResource(R.drawable.dashedbordersmall);*/ 
 
     m_absZoomlayout.addView(m_ivtmpImage); 
 
     m_absTextlayout.addView(m_absZoomlayout); 
 
     m_absTextlayout.addView(m_btnZoom); 
 
     m_absTextlayout.setDrawingCacheEnabled(true); 
 
     m_absTextlayout.setClickable(true); 
 
     m_absTextlayout.setId(0); 
 
     m_ivtmpImage.setId(0); 
 
     m_vtoTree =m_absTextlayout.getViewTreeObserver(); 
 
     m_vtoTree.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { 
 
      @Override 
 
      public void onGlobalLayout() { 
 
       m_absTextlayout.getViewTreeObserver() 
 
         .removeGlobalOnLayoutListener(this); 
 
      } 
 
     }); 
 
     /** 
 
     * Add all the views into arraylist which are added into the screen for 
 
     * further to perform deletion of each views. 
 
     */ 
 
     m_signVo = new ViewsVo(); 
 
     m_arrSignObjects.add(0, m_signVo); 
 
     m_absolutelayout.addView(m_absTextlayout); 
 
     // Image touch listener to move image onTouch event on screen. 
 
     m_touchImagListener = new View.OnTouchListener() { 
 
      @Override 
 
      public boolean onTouch(View v, MotionEvent event) { 
 
       switch (event.getAction() & MotionEvent.ACTION_MASK) { 
 
        case MotionEvent.ACTION_DOWN: 
 
         m_oldX = event.getX(); 
 
         m_oldY = event.getY(); 
 
         break; 
 
        case MotionEvent.ACTION_UP: 
 
        case MotionEvent.ACTION_POINTER_UP: 
 
         break; 
 
        case MotionEvent.ACTION_MOVE: 
 
         m_dX = event.getX() - m_oldX; 
 
         m_dY = event.getY() - m_oldY; 
 
         m_posX = m_prevX + m_dX; 
 
         m_posY = m_prevY + m_dY; 
 
         if (m_posX > 0 && m_posY > 0&& (m_posX + v.getWidth()) < m_absolutelayout.getWidth()&& (m_posY + v.getHeight()) < m_absolutelayout.getHeight()) 
 
         { 
 
          v.setLayoutParams(new AbsoluteLayout.LayoutParams(v.getMeasuredWidth(), v.getMeasuredHeight(),(int) m_posX, (int) m_posY)); 
 
          m_prevX = m_posX; 
 
          m_prevY = m_posY; 
 
         } 
 
         break; 
 
       } 
 
       return false; 
 
      } 
 
     }; 
 
     // Listener for the arrow ontouch of arrow ZoomIn and ZoomOut the image. 
 
     m_strecthArrowListener = new View.OnTouchListener() { 
 
      @Override 
 
      public boolean onTouch(View v, MotionEvent event) { 
 
       View view; 
 
       view = v; 
 
       v.setClickable(true); 
 
       v.setDrawingCacheEnabled(true); 
 
       AbsoluteLayout m_absLayout = null; 
 
       switch (event.getAction() & MotionEvent.ACTION_MASK) { 
 
        case MotionEvent.ACTION_DOWN: 
 
         m_oldX = event.getX(); 
 
         m_oldY = event.getY(); 
 
         break; 
 
        case MotionEvent.ACTION_UP: 
 
        case MotionEvent.ACTION_POINTER_UP: 
 
         break; 
 
        case MotionEvent.ACTION_MOVE: 
 
         m_newX = event.getX(); 
 
         m_newY = event.getY(); 
 
         float newDist = m_newX - m_oldX; 
 
         if (m_newX > m_oldX && m_newY > m_oldY) { 
 
          if (newDist > 0.0f) { 
 
           m_scale = 1; 
 
           m_absLayout = (AbsoluteLayout) v.getParent(); 
 
           int m_hightOfImage = (int) (m_scale + (((ImageView) ((AbsoluteLayout) m_absLayout.getChildAt(1)).getChildAt(0)).getHeight())); 
 
           int m_widthOfImage = (int) (m_scale + (((ImageView) ((AbsoluteLayout) m_absLayout.getChildAt(1)).getChildAt(0)).getWidth())); 
 
           m_widthDelete = (int) (m_scale + ((((AbsoluteLayout) m_absLayout.getChildAt(1))).getWidth())); 
 
           if (m_absLayout.getBottom() <= (m_ivImage.getBottom()) 
 
             && m_absLayout.getRight() <= (m_DisplayWidth)) { 
 
            m_layoutparams = new AbsoluteLayout.LayoutParams(m_widthOfImage, m_hightOfImage, 0, 0); 
 
            ((ImageView) ((AbsoluteLayout) m_absLayout.getChildAt(1)).getChildAt(0)).setLayoutParams(m_layoutparams); 
 
            m_layoutparams = new AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT,AbsoluteLayout.LayoutParams.WRAP_CONTENT,m_absLayout.getLeft(), m_absLayout.getTop()); 
 
            m_absLayout.setLayoutParams(m_layoutparams); 
 
            ((Button) m_absLayout.getChildAt(0)).setLayoutParams(new AbsoluteLayout.LayoutParams(m_deleteEditHeightwidth,m_deleteEditHeightwidth,m_widthDelete, 0)); 
 
            ((Button) m_absLayout.getChildAt(2)).setLayoutParams(new AbsoluteLayout.LayoutParams(m_deleteEditHeightwidth,m_deleteEditHeightwidth,m_widthDelete, m_widthDelete)); 
 
            m_hightOfImage = (int) (m_scale + (((AbsoluteLayout) m_absLayout.getChildAt(1)).getHeight())); 
 
            m_widthOfImage = (int) (m_scale + (((AbsoluteLayout) m_absLayout.getChildAt(1)).getWidth())); 
 
            m_layoutparams = new AbsoluteLayout.LayoutParams(m_widthOfImage, m_hightOfImage,((AbsoluteLayout) m_absLayout .getChildAt(1)).getLeft(),((AbsoluteLayout) m_absLayout .getChildAt(1)).getTop()); 
 
            ((AbsoluteLayout) m_absLayout.getChildAt(1)).setLayoutParams(m_layoutparams); 
 
           } 
 
          } 
 
         } 
 
         if (m_newX < m_oldX && m_newY < m_oldY) { 
 
          m_absLayout = (AbsoluteLayout) view.getParent(); 
 
          int m_hightOfImage = (int) (((ImageView) ((AbsoluteLayout) m_absLayout.getChildAt(1)).getChildAt(0)).getHeight() - m_scale); 
 
          int m_widthOfImage = (int) (((ImageView) ((AbsoluteLayout) m_absLayout.getChildAt(1)).getChildAt(0)).getWidth() - m_scale); 
 
          m_widthDelete = (int) (((AbsoluteLayout) m_absLayout.getChildAt(1)).getWidth() - m_scale); 
 
          m_layoutparams = new AbsoluteLayout.LayoutParams(m_widthOfImage, m_hightOfImage, 0, 0); 
 
          ((ImageView) ((AbsoluteLayout) m_absLayout.getChildAt(1)).getChildAt(0)).setLayoutParams(m_layoutparams); 
 
          m_layoutparams = new AbsoluteLayout.LayoutParams(
 
            AbsoluteLayout.LayoutParams.WRAP_CONTENT, 
 
            AbsoluteLayout.LayoutParams.WRAP_CONTENT, 
 
            m_absLayout.getLeft(), m_absLayout.getTop()); 
 
          m_absLayout.setLayoutParams(m_layoutparams); 
 
          ((Button) m_absLayout.getChildAt(0)).setLayoutParams(new AbsoluteLayout.LayoutParams(m_deleteEditHeightwidth, 
 
            m_deleteEditHeightwidth, m_widthDelete,0)); 
 
          ((Button) m_absLayout.getChildAt(2)).setLayoutParams(new AbsoluteLayout.LayoutParams(m_deleteEditHeightwidth, 
 
            m_deleteEditHeightwidth, m_widthDelete,m_widthDelete)); 
 
          m_hightOfImage = (int) ((((AbsoluteLayout) m_absLayout 
 
            .getChildAt(1)).getHeight()) - m_scale); 
 
          m_widthOfImage = (int) ((((AbsoluteLayout) m_absLayout 
 
            .getChildAt(1)).getWidth()) - m_scale); 
 
          m_layoutparams = new AbsoluteLayout.LayoutParams(
 
            m_widthOfImage, m_hightOfImage, ((AbsoluteLayout) m_absLayout.getChildAt(1)).getLeft(),((AbsoluteLayout) m_absLayout.getChildAt(1)).getTop()); 
 
          ((AbsoluteLayout) m_absLayout.getChildAt(1)) 
 
            .setLayoutParams(m_layoutparams); 
 
         } 
 
         break; 
 
       } 
 
       return false; 
 
      } 
 
     }; 
 
     m_absTextlayout.setOnTouchListener(m_touchImagListener); 
 
     m_btnZoom.setOnTouchListener(m_strecthArrowListener); 
 
    } 
 
    // Delete button listener to show the alert and confirmation for deleting 
 
    // the items. 
 
    private class ImageDeleteListener implements View.OnClickListener { 
 
     @Override 
 
     public void onClick(final View v) { 
 
      AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
 
        m_context); 
 
      alertDialogBuilder.setTitle("Drag & Drop"); 
 
      alertDialogBuilder 
 
        .setMessage("Are you sure you want to delete ?") 
 
        .setCancelable(false) 
 
        .setPositiveButton("Yes", 
 
          new DialogInterface.OnClickListener() { 
 
           public void onClick(DialogInterface dialog, 
 
                int id) { 
 
            m_ImageCount--; 
 
            for (int counter = 0; counter < m_arrSignObjects 
 
              .size(); counter++) { 
 
             if (v.getId() == m_arrSignObjects.get(counter).getViewId()) { 
 
              if (m_totalTextViewCount <= 0) { 
 
               m_AddedViewsHeightText = m_AddedViewsHeightText 
 
                 - m_arrSignObjects.get(counter).getViewHeight(); 
 
              } else { 
 
               m_totalTextViewCount--; 
 
              } 
 
              m_absolutelayout.removeView((View) v 
 
                .getParent()); 
 
              m_arrSignObjects.remove(counter); 
 
              break; 
 
             } 
 
            } 
 
           } 
 
          }).setNegativeButton("No",new DialogInterface.OnClickListener() 
 
      { 
 
       public void onClick(DialogInterface dialog, 
 
            int id) { 
 
        // if this button is clicked, just close 
 
        // the dialog box and do nothing 
 
        dialog.cancel(); 
 
       } 
 
      }); 
 
      // create alert dialog 
 
      AlertDialog alertDialog = alertDialogBuilder.create(); 
 
      // show it 
 
      alertDialog.show(); 
 
     } 
 
    } 
 

 
}

ich gemacht Drag and Drop

Objekte auf Finger-Touch im Android Move

Referenz Website dieses: http://grishma102.blogspot.kr/2013/10/drag-and-drop-functionality-to-move.html

Aber zoom meine Tätigkeit des in, vergrößern oder verkleinern Sie nicht funktionieren, wenn ich Gegenstände auf Finger-Touch bewegen, Die Objekte werden nur herausgezoomt und ausgeblendet.

mir bitte helfen ..

Antwort

0

Versuchen zwingende OnDrag() Zuhörer statt OnTouch()

view.setOnDragListener(new View.OnDragListener() { 
@Override 
public boolean onDrag(View view, DragEvent dragEvent) { 
    return true; 
} 
});