Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
FormattedSection.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under Apache 2.0 License. See LICENSE.md for details.
3 //
4 // Copyright 2011-2012 Xamarin Inc.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 //
18 
19 using System;
20 
21 using Android.App;
22 using Android.Content;
23 using Android.OS;
24 using Android.Runtime;
25 using Android.Views;
26 using Android.Widget;
27 
28 using MonoDroid.Dialog;
29 
30 namespace Android.NUnitLite.UI {
31 
32  // can't really name it HtmlSection wrt HtmlElement ;-)
33  public class FormattedSection : Section {
34 
35  public FormattedSection (string html)
36  : base (html)
37  {
38  }
39 
40  public override View GetView (Context context, View convertView, ViewGroup parent)
41  {
42  TextView tv = new TextView (context);
43  tv.TextSize = 20f;
44  tv.SetText (Android.Text.Html.FromHtml (Caption), TextView.BufferType.Spannable);
45 
46  var parms = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
47  parms.AddRule (LayoutRules.CenterHorizontal);
48 
49  RelativeLayout view = new RelativeLayout (context, null, Android.Resource.Attribute.ListSeparatorTextViewStyle);
50  view.AddView (tv, parms);
51  return view;
52  }
53  }
54 }
55 
override View GetView(Context context, View convertView, ViewGroup parent)
Overriden my most derived classes, creates a view that creates a View with the contents for display ...
Sections contain individual Element instances that are rendered by MonoDroid.Dialog ...
Definition: Section.cs:28