0
私はXamarin.Formsレイアウトを使用していますが、それはStepper
です。Xamarin Androidでステッパーのネイティブコントロールを使用する方法
、それは次のようになります。
今では私がUWP性能はウェイウェイウェイ、通常のスクロール速度を下回っているとして、各プラットフォーム上でカスタムセルを作成する必要があることと思われます。
このページによると、Stepper
はアンドロイドでカスタムビューを経由してレンダリングされます。
私はAndroidのレイアウトを作成し、私はStepperRendererを使用するが、私は方法がわかりませんに viewcell私のカスタム内部のカスタムビューを膨らま:
<LinearLayout
android:id="@+id/Layout1"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dip">
<TextView
android:id="@+id/Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF7F3300"
android:textSize="20dip"
android:textStyle="italic" />
<!-- NumberPicker is not applicable-->
<NumberPicker
android:id="@+id/Stepper"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<!--StepperRenderer
android:id="@+id/Stepper"
android:layout_width="wrap_content"
android:layout_height="wrap_content" /-->
<Spinner
android:id="@+id/Picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
{
var x = (MyViewCell)item;
var view = convertView;
if (view == null)
{
// no view to re-use, create new
view = (context as Activity).LayoutInflater.Inflate(Resource.Layout.MyViewCellLayout, null);
}
view.FindViewById<TextView>(Resource.Id.Text).Text = x.Text;
view.FindViewById<NumberPicker>(Resource.Id.Stepper).Value = x.Value;
return view;
}
私は私のviewCellでそのビューを使用することができますどのように任意のアイデア?
カスタムXamarin.Formsコントロールを作成する場合に便利ですが、ネイティブパフォーマンスの機能を利用してAndroidプロジェクトにAndroidコントロールが必要です。私はそれを再実装したくない、私はちょうどステッパーレンダラーを再利用したい。 – Nestor