本文整理汇总了C#中Android.App.Activity.SetContentView方法的典型用法代码示例。如果您正苦于以下问题:C# Activity.SetContentView方法的具体用法?C# Activity.SetContentView怎么用?C# Activity.SetContentView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.App.Activity
的用法示例。
在下文中一共展示了Activity.SetContentView方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainActivityBinding
private MainActivityBinding(Activity activity, int layoutId)
{
activity.SetContentView(layoutId);
toolbar = activity.FindViewById<Toolbar>(Resource.Id.toolbar);
drawer = activity.FindViewById<DrawerLayout>(Resource.Id.drawer);
navView = activity.FindViewById<NavigationView>(Resource.Id.nav_view);
var decorView = activity.Window.DecorView;
Root = (ViewGroup) decorView.FindViewById(global::Android.Resource.Id.Content);
}
示例2: WebViewActivityBinding
private WebViewActivityBinding(Activity activity, int layoutId)
{
activity.SetContentView(layoutId);
webview = activity.FindViewById<WebView>(Resource.Id.webview);
toolbar = activity.FindViewById<Toolbar>(Resource.Id.toolbar);
var decorView = activity.Window.DecorView;
Root = (ViewGroup) decorView.FindViewById(global::Android.Resource.Id.Content);
}
示例3: Bind
public void Bind(Activity activity)
{
if (activity == null)
throw new ArgumentNullException();
activity.SetContentView(ResourceId);
if (BindOutlets)
{
FieldInfo[] fields = activity.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
foreach (FieldInfo field in fields)
{
object[] outlets = field.GetCustomAttributes(typeof(OutletAttribute), false);
if (outlets.Length == 0)
continue;
OutletAttribute outlet = (OutletAttribute) outlets[0];
field.SetValue(activity, activity.FindViewById(outlet.ResourceId));
}
}
if (BindActions)
{
MethodInfo[] methods = activity.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance);
foreach (MethodInfo method in methods)
{
object[] actions = method.GetCustomAttributes(typeof(ActionAttribute), false);
if (actions.Length == 0)
continue;
foreach (ActionAttribute action in actions)
{
try
{
FieldInfo field = activity.GetType().GetField(action.Field, BindingFlags.NonPublic | BindingFlags.Instance);
if (field == null)
throw new Exception();
EventInfo handler = field.FieldType.GetEvent(action.Handler, BindingFlags.Public | BindingFlags.Instance);
if (handler == null)
throw new Exception();
handler.AddEventHandler(field.GetValue(activity), Delegate.CreateDelegate(handler.EventHandlerType, activity, method));
}
catch
{
Console.WriteLine("Can't bind {0}.{1} with {2}", action.Field, action.Handler, method.Name);
continue;
}
}
}
}
}
示例4: AndroidDevice
public AndroidDevice(Activity activity, ConnectionType connectionType, string connectionString)
: base(connectionType, connectionString, new JsonProvider())
{
// Setup the WebView/Browser
_activity = activity;
Browser = new AndroidBrowser(new WebView(activity));
_activity.SetContentView(WebView);
// Populate device info
Wifi = (WifiManager)activity.GetSystemService(Context.WifiService);
DeviceInfo = new DeviceInfo();
DeviceInfo.MobileOs = MobileOs.Android;
DeviceInfo.DeviceModel = Build.Model;
DeviceInfo.OsVersion = Build.VERSION.Release;
DeviceInfo.IP = IP;
var tm = (TelephonyManager)activity.GetSystemService(Context.TelephonyService);
DeviceInfo.UniqueId = tm.DeviceId;
}
示例5: OnElementChanged
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.Page> e)
{
base.OnElementChanged (e);
mActivity = this.Context as Activity;
mActivity.SetContentView (Resource.Layout.ConferencePageLayout);
mPublisherViewContainer = (RelativeLayout) mActivity.FindViewById(Resource.Id.publisherview);
mSubscriberViewContainer = (RelativeLayout) mActivity.FindViewById(Resource.Id.subscriberview);
mStreams = new List<Stream>();
SessionConnect();
/*
var activity = this.Context as Activity;
var conferenceActivity = new Intent (activity, typeof (ConferenceActivity));
activity.StartActivity (conferenceActivity);
*/
}