[英]Border Class analog in Xamarin Android
我想繪制一個燭台圖表(500個圖釘)。 在WPF中,我可以在1個滾動查看器中使用500個邊框(System.Windows.Controls.Border)。 我還可以在需要時更改任何項目。
如何在Xamarin.Android中執行相同的操作? Xamarin.Android不包含Border類。
您可以使用ScrollView
,其中包含一個LinearLayout
其自身包含500倍簡單的<View>
,其大小和可繪制stroke
作為背景
就像是
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom"
>
<View
android:layout_width="50dp"
android:layout_height="100dp"
android:background="@drawable/border_white"
/>
<View
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/border_white"
/>
在res / drawable中,有一個名為border_white的文件
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="2dip" android:color="@android:color/white" />
</shape>
但是我告訴你,這會非常慢(可能就像在Windows上一樣)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.