的頂部圓形圖像必須把兩者在所述中心點將same.These 2個imageviews處於相對佈局相同的位置。 請幫助..兩個上我有不同sizes.I兩個不同的圓形圖像彼此
0
A
回答
0
難不幫你的佈局XML代碼。話雖如此,當你看到「一個在另一個之上」時,你需要考慮FrameLayout
。
0
使用的FrameLayout,並設置相同的背景圖像,然後用重力佈局設置爲左或右或中間添加在上面的圖像。
1
當使用相對佈局的唯一選擇這樣做,是在佈局,以中心組圖片,但如果你開始添加更多的元素,比如上面的一些文本/低於任何圖像,結果會不會像預期。
所以我的建議是以編程方式進行。您可以定義一個視圖並覆蓋onDraw()方法。然後,您將通過兩個ImageView(或BitmapFactory)加載位圖。然後將其繪製到所需位置的畫布上。要找出每個圖像的中心,您可以使用您從View method getDrawingRect得到Rect class應用(使大小計算)的佈局屬性後,,或通過手(創建一個矩形與您加載的位圖的尺寸德使用BitmapFactory)
其他替代方法是使用LayerDrawable並定義圖像位置以使它們居中(您需要事先知道圖像尺寸)。
0
在創建新sublayout代替,則可能會使該ImageViews在各方面調整和設置scaleType
屬性類似center
:
<ImageView
android:id="@+id/circle_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/..."
android:scaleType="center"/>
<ImageView
android:id="@+id/circle_b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/..."
android:layout_alignTop="@+id/circle_a"
android:layout_alignBottom="@+id/circle_a"
android:layout_alignLeft="@+id/circle_a"
android:layout_alignRight="@+id/circle_a"
android:scaleType="center" />
這將給circle_b
ImageView的實際尺寸相同circle_a
,但設置適當的scaleType將防止圖像被拉伸或未對齊。
//編輯:UPS,我的意思是說center
...糾正。
相關問題
- 1. 在兩個不同設備(不同屏幕密度)上的相同圖像上繪製相同的圓形
- 2. 在同一個圖表上繪製兩個不同的圖形
- 3. 如何讓兩個相同的圖像彼此分開移動?
- 4. 兩個圖像在彼此的頂部
- 5. d3.js同一頁上的兩個圖是對彼此
- 6. 如何合併兩個在git中彼此不同的分支
- 7. 用不同的StreamingContext彼此打開兩個KafkaStreams
- 8. iOS兩個不同的應用程序彼此對話
- 9. 我如何加入兩個圖像彼此上方
- 10. 在同一圖形/ matlab上繪製兩個不同的公式
- 11. 同一圖上的兩個箱形圖
- 12. 兩種不同形式的圖像盒
- 13. 這兩個指針如何彼此不同?
- 14. 如何讓我的兩個d3圖形彼此相鄰?
- 15. 兩個彼此相鄰的高度相同的視圖
- 16. 爲什麼這兩個圖像不想彼此重疊?
- 17. 同一圖中的兩個不同圖
- 18. 如何使用兩個不同的按鈕在兩個單獨的圖像視圖上添加兩個圖像
- 19. 有兩個不同的列
- 20. 有兩個不同的值
- 21. 兩個得到不斷改變彼此
- 22. 兩個節點不閒話彼此
- 23. Facebook共享具有兩個不同維度的相同圖像
- 24. 有兩個不同的圖像都顯示相同
- 25. 兩個類似Facebook就像兩個不同的縮略圖
- 26. 我們兩個不同
- 27. 將兩個跨度放在同一行上彼此相鄰?
- 28. 彼此相鄰的兩個矩形不工作(爪哇)
- 29. 兩個等同的功能有兩個不同的輸出
- 30. 使用回形針將兩個不同的圖像上傳到一個模型