對我有用的解決方案: foreach (var option in options) { RadioButton rb = new RadioButton(Context); rb.SetButtonDrawable(null); rb.SetCompoundDrawablesWithIntrinsicBounds(null,null,null,ContextCompat.GetDrawable(Context, Android.Resource.Drawable.ButtonRadio)); rb.Text = option.Text; rb.Gravity = GravityFlags.Center; radioGroup.AddView(rb); } // Weight für die RBs setzen for (int i = 0; i < radioGroup.ChildCount; i++) { var currentRb = radioGroup.GetChildAt(i); LinearLayout.LayoutParams rbParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WrapContent) {Weight = 1}; currentRb.LayoutParameters = rbParams; }.axml 中的簡化 RadioGroup: <LinearLayout android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:gravity="center" android:layout_width="match_parent" android:id="@+id/formItemScaleLayout" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/formItemScaleStart" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Start"/> <RadioGroup android:layout_weight="1" android:id="@+id/formItemScaleRadioGroup" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > </RadioGroup> <TextView android:id="@+id/formItemScaleEnd" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="End"/></LinearLayout>
1 回答

夢里花落0921
TA貢獻1772條經驗 獲得超6個贊
您的第二個示例不是有效的 JSON?;叵胍幌拢琂SON 基于 JavaScript,在該語言中,任何以 0 開頭的數字文字都被解釋為八進制數。有效的八進制數字是 0-7,因此如果文字包含 8 或 9,則無法解析它并會引發錯誤。('010203' 有效,因為它是一個有效的八進制文字,但 '070809' 不是)
- 1 回答
- 0 關注
- 270 瀏覽
添加回答
舉報
0/150
提交
取消