【发布时间】:2019-09-04 15:10:05
【问题描述】:
我的任务是创建一个程序,在主屏幕上显示两个按钮以及我的姓名和当前时间/日期。目标是一旦按下其中一个按钮就会出现一个段落,这将利用整个屏幕。到目前为止,我已经创建了带有标签和按钮的主页。但是,对于如何显示与单击的按钮相关的段落,我非常迷茫。我正在使用经验拟合的文本方式来充分利用屏幕。我创建了一个 FontCalc.Cs 页面并在我拥有所有代码的主页中添加了 onContentViewSizeChanged 方法。我不知道下一步该怎么做。到目前为止,这就是我在点击处理程序事件中的内容:
passage1Button.Clicked += (sender, args) =>
{
passage.Text = "So they began working together, each squadron leader commanding indivual pilots, " +
"Ender comanding the squadron leaders. They learned manyw ays of working together, " +
"as the simulator forced them to try different situations. Sometimes the simulator " +
"gave them a larger fleet to work with; Ender set them up then in three or four " +
"toons that consisted of three or four squadrons each. Sometimes the simulator gave " +
"them a single starship with its twelve fighters, and he chose three sqaudron leaders. ";
ContentView contentView = new ContentView
{
Content = passage
};
contentView.SizeChanged += onContentViewSizeChanged;
它不会在按钮消失的同时显示段落,它只会冻结 android 模拟器和 UWP 本地计算机。
【问题讨论】:
标签: xamarin xamarin.forms xamarin.android xamarin.uwp