【发布时间】:2017-11-16 08:19:37
【问题描述】:
我在按钮点击处理程序中有以下代码:
LinearLayout linearLayoutParent = FindViewById<LinearLayout>(Resource.Id.linearLayoutParent);
LinearLayout linearLayoutFileTransferVia = new LinearLayout(this);
TextView labelFileTransferViaInfo = new TextView(this);
labelFileTransferViaInfo.LayoutParameters = lp;
labelFileTransferViaInfo.Text = "Choose file transfer via to FTP Server";
labelFileTransferViaInfo.SetTextAppearance(Android.Resource.Style.TextAppearanceLarge);
RadioButton rbWiFi = new RadioButton(this);
RadioButton rb3G = new RadioButton(this);
RadioGroup radioGroupFileTransferType = new RadioGroup(this);
radioGroupFileTransferType.Orientation = Orientation.Horizontal;
rbWiFi.Text = "Wi-Fi";
rb3G.Text = "3G";
radioGroupFileTransferType.AddView(rbWiFi);
radioGroupFileTransferType.AddView(rb3G);
linearLayoutFileTransferVia.AddView(labelFileTransferViaInfo);
linearLayoutFileTransferVia.AddView(radioGroupFileTransferType);
linearLayoutParent.AddView(linearLayoutFileTransferVia);
当我单击按钮时 labelFileTransferViaInfo 出现在屏幕上,但 radioGroupFileTransferType 没有。您认为发生这种情况的问题是什么?
【问题讨论】:
-
尝试为您的线性布局设置方向。
-
我已经完成了我只是没有在这里粘贴代码所以它不会那么长。
标签: android radio-button appearance