2016-02-13 118 views
1

如何讓TextView長時間點擊漣漪?它漣漪很好onClick但我需要紋波onLongClickTextView中的波紋效果長按

+0

如果有人想要更多的上下文,我的問題是後續http://stackoverflow.com/questions/35373987/change-textview-background-with-ripples –

回答

2

您可以使用Android Ripple Background

final RippleBackground rippleBackground=(RippleBackground)findViewById(R.id.content); 
    ImageView imageView=(ImageView)findViewById(R.id.centerImage); 
    imageView.setOnLongClickListener(new View.OnLongClickListener() { 
      @Override 
      public boolean onLongClick(View v) { 
       rippleBackground.startRippleAnimation(); 
       return false; 
      } 
     }); 
+0

它不起作用。您的解決方案似乎要求TextView小於「RippleBackground」。但那對我不起作用。我需要類似於'android:background =「?attr/selectableItemBackground」' –

-2

有實現longClickListener這是一個多方面的。基本上,一個事件被觸發的例子是mouseover,onclick,onlongclick,onlistitemclick和「聽到」事件的聽衆。如果您需要更多幫助,請發佈代碼,您是否創建了新的OnLongClickListener()對象?

+0

這樣回答關於漣漪的OP問題的東西嗎? –

+0

如果你讀他可以做漣漪:「它漣漪罰款onClick」 – Pomagranite