回答
RelativeLayout是一個不錯的選擇。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:scaleType="centerCrop"
android:src="@drawable/iconImage" />
<ImageView
android:id="@+id/badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/icon"
android:layout_alignTop="@+id/icon"
android:src="@drawable/badge" />
如果你真的想用一個動態的數字/文本徽章,那麼你可以讓第二ImageView
一個TextView
(或ViewGroup
如LinearLayout
或RelativeLayout
),並給它一個背景繪製和將文本設置爲你想要的。
謝謝,那太棒了。 – StackOverflowed
@Sam Dozor我如何獲得徽章imageview在第一個ImageView的外部顯示(它當前顯示在imageview圖標的內部)。 –
看看github上的ViewBadger項目(但請記住,您不應該嘗試複製Android應用中的其他平臺UI元素)。
+1不要複製其他平臺UI! –
我通常討厭+1,但+1。在那裏,做到了,一個痛苦的世界 - 永遠不會。 – Simon
- 1. ImageView,如何設置圖像看起來在另一個圖像的前面?
- 2. 將一個圖像放在android中的另一個圖像上
- 3. 如何通過onclick將圖像放置在android中的另一個圖像上?
- 4. 如何在HTML中將一個圖像置於另一個圖像的頂部
- 5. Android:在另一個圖像上放置一個圖像
- 6. 如何在Android XML中將圖像置於其他圖像之上?
- 7. 如何將一個圖像置於另一個圖像的中心
- 8. 內容如何看起來像圖像
- 9. 我的.aspx頁面上的徽標圖像的一部分正在被分區重疊;如何將徽標圖像置於一切之上?
- 10. 我們如何將圖像放在另一張圖像上
- 11. 在android中的另一個圖像視圖中放置圖像
- 12. UIPickerView在Android上看起來很像
- 13. 圖像看起來像一個破碎的圖像
- 14. 如何在UILabel中插入圖像,或使其看起來像我一樣?
- 15. 如何顯示一個圖像查看另一個圖像?
- 16. Android:如何在另一個圖像視圖中嵌入圖像?
- 17. 如何讓UIPickerView看起來像圖像中的那個?
- 18. 顯示兩個圖像一個在另一個之上的Android
- 19. 如何在一個標籤中放置圖像,使其看起來像一個圖標
- 20. 如何使edittext看起來像一個頁面在android
- 21. 如何將圖像與MP3相結合,看起來像視頻中的Android
- 22. 如何在css中將一個圖像疊加到另一個圖像上?
- 23. 如何通過將圖像懸停在另一個div中來將圖像懸停在一個div上?
- 24. 如何在android中使列表視圖看起來像lined paper?
- 25. 在imageview中設置圖像,使其看起來像一個進度條
- 26. 如何把圖像放在中心上方的另一個圖像在android中?
- 27. 一個詞在iPad上看起來像兩個,但在桌面上看起來像兩個。 (這很難說)
- 28. 如何將圖像放在另一個android應用程序上?
- 29. Android - 看起來像'設置'的ListView
- 30. 如何將徽標圖像置於標題中心
永遠不會*,永遠*,***永遠***使用'AbsoluteLayout'。永遠。 –
@AlexLockwood:那麼你想說的是人們不應該使用'AbsoluteLayout'?只是想我會檢查。 ; D – Squonk
@Squonk,當涉及到這些東西時,沒有「過於強調」的東西......尤其是在StackOverflow上:P –