2013-08-27 25 views
0

我有兩個圖像(上面,下面)相互放置。我想隱藏用戶觸摸的上述圖像的一部分。在上面的圖像將完全刪除和下面的圖像完全可見。隱藏一個圖像並顯示其他

我將如何在Android中實現這一目標。我真的無能爲力。請幫助

+0

看看這一個:http://stackoverflow.com/questions/8220354/android-touch-to-erase-portions-of-foreground-imageview-to-expose-background-v – lindatseng

+0

它只是一個提示類型。它可能會幫助你。將onTouchListener添加到ImageView中,然後獲取x,y座標並使用makeRect方法顯示圖像的該部分。 – Arshu

回答

1

例如:

button = (Button) findViewById(R.id.button); 
leftButton.setOnClickListener(new Button.OnClickListener() { 
    public void onClick(View v) 
     { 
      image.setVisibility(View.INVISIBLE); //to set the image as invisible 
      image.setVisibility(View.VISIBLE); // to set it back to visible 
     } 
    }); 

希望這會幫助你。

+0

他想隱藏圖像的一部分。不是整個圖像。 – dymmeh

+0

糟糕,沒有讀得不夠好,晚餐後會看這個。 – Wannabe