本文整理汇总了C#中Android.Widget.TextView.RequestLayout方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.RequestLayout方法的具体用法?C# TextView.RequestLayout怎么用?C# TextView.RequestLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Widget.TextView
的用法示例。
在下文中一共展示了TextView.RequestLayout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NoteRepresentation
/// <summary>
/// Constructs a new representation as a visual ball with a number of string in its center.
/// </summary>
/// <param name="currentActivity">The activity on which the ball should be drawn.</param>
/// <param name="note">The note that should be played correspondingly when visually arriving to the guitar's neck.</param>
public NoteRepresentation(Activity currentActivity, Note note)
{
//Basic values.
_currentActivity = currentActivity;
_note = note;
//The color of the ball.
BallColor ballColor = (BallColor)note.Position.String; //note.Position.Fret;
//Which string the number on the ball should represent.
//GuitarString stringNum = note.Position.String;
_noteCircle = new TextView(_currentActivity);
//Select the ball's color.
switch (ballColor)
{
case BallColor.Red:
_noteCircle.SetBackgroundResource(Resource.Drawable.ball_red);
break;
case BallColor.Purple:
_noteCircle.SetBackgroundResource(Resource.Drawable.ball_purple);
break;
case BallColor.Blue:
_noteCircle.SetBackgroundResource(Resource.Drawable.ball_blue);
break;
case BallColor.Green:
_noteCircle.SetBackgroundResource(Resource.Drawable.ball_green);
break;
case BallColor.Orange:
_noteCircle.SetBackgroundResource(Resource.Drawable.ball_orange);
break;
case BallColor.Aqua:
_noteCircle.SetBackgroundResource(Resource.Drawable.ball_aqua);
break;
case BallColor.Yellow:
_noteCircle.SetBackgroundResource(Resource.Drawable.ball_yellow);
break;
}
//Set dimensions.
_noteCircle.Layout(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT);
//Center text.
_noteCircle.Gravity = GravityFlags.Center;
//Set text.
//_noteCircle.SetText(((int)stringNum).ToString(), TextView.BufferType.Normal);
//Refresh view.
_noteCircle.RequestLayout();
//Add the newly created note circle to the current activity.
_currentActivity.AddContentView(_noteCircle, new ViewGroup.LayoutParams(BUTTON_WIDTH, BUTTON_HEIGHT));
}