我有一個imageview,它將導航到另一個頁面,一旦點擊。現在,當它被點擊時,用戶不會感到被點擊。所以我想要的是在點擊圖像時有一些效果(如在正常按鈕中)....任何人都可以幫助我嗎?按鈕像點擊效果在Android的圖像查看器
2
A
回答
4
儘量選擇這樣的
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape>
<solid android:color="#151B8D" />
<stroke android:width="1dp" android:color="#151B8D" />
<corners android:bottomLeftRadius="8dp" android:bottomRightRadius="0dp" android:topLeftRadius="0dp" android:topRightRadius="8dp" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
</shape></item>
<item><shape>
<gradient android:angle="270" android:endColor="#151B8D" android:startColor="#151B8D" />
<stroke android:width="1px" android:color="#000000" />
<corners android:bottomLeftRadius="8dp" android:bottomRightRadius="0dp" android:topLeftRadius="0dp" android:topRightRadius="8dp" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
</shape></item>
</selector>
0
假設你指的是身體沒有明顯的感覺,使用像這樣的東西發出聲音,並提供觸覺反饋:
iv.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
iv.playSoundEffect(SoundEffectConstants.CLICK);
其中IV是你的ImageView的。
0
談到XML選擇,這裏是鏈接,能不能幫xml selector link
7
使用風格= 「機器人:borderlessButtonStyle」在XML文件中。 它會顯示android默認點擊效果。
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
style="?android:borderlessButtonStyle"
/>
+0
完美的答案。 – zackygaurav
+0
這改變了Imageview的寬度。 –
相關問題
- 1. 點擊圖像按鈕效果
- 2. 點擊按鈕查看圖像。 qt
- 3. 圖像查看器/按鈕圖像
- 4. 按鈕VS可點擊圖像,看起來像按鈕
- 5. 如何在Android上爲按鈕提供像點擊效果?
- 6. android onclickuplistener爲圖像查看按鈕?
- 7. Android圖像移動按鈕點擊
- 8. 如何查看點擊按鈕上的圖像?
- 9. 像不像按鈕recycler查看圖片
- 10. 在Swing中使圖像按鈕看起來被按下/點擊
- 11. Android:圖像按鈕或按鈕突出顯示效果時按
- 12. 按鈕與圖像,圖像消失點擊按鈕時iOS 10
- 13. 在圖像上添加按鈕查看
- 14. 模擬器不顯示按鈕上的圖像點擊Android
- 15. 更改圖像在按鈕點擊ios
- 16. 按下按鈕全屏查看圖像
- 17. Silverlight按鈕點擊效果
- 18. 帶有點擊效果的圖像
- 19. 點擊圖像查看在Android上的圖庫中打開圖像
- 20. 如何在alertdialog按鈕中添加按鈕點擊效果android
- 21. 點擊按鈕查看divs
- 22. 更改圖像的按鈕在列表中查看它在android
- 23. 獲取點擊圖像按鈕的ID
- 24. 旋轉按鈕上的圖像點擊
- 25. WPF點擊按鈕滾動查看器
- 26. 圖像視圖在iPhone中可按鈕點擊按鈕
- 27. 如何讓圖像按鈕有效果?
- 28. 帶圖像的按鈕:單擊時抑制輕彈效果
- 29. 點擊電子郵件圖像查看
- 30. 通過點擊隱藏圖像查看?
把選擇XML –
你可以像剛纔設置的按鈕,但使用一個選擇可能是比較容易 –