我正在尝试实施以下内容:http://blog.grafixartist.com/quick-return-pattern-with-android-design-support-library/
当我创建一个新的Forms项目时,我得到以下Toolbar.axml
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
MainActivity.cs
using System;
using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace ListViewT.Droid
{
[Activity(Label = "ListViewT", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
}
}
查看FormsAppCompatActivity
,这些布局似乎没有任何内容:
public class FormsAppCompatActivity : AppCompatActivity, IDeviceInfoProvider, IStartActivityForResult
{
protected FormsAppCompatActivity();
public static int TabLayoutResource { get; set; }
public static int ToolbarResource { get; set; }
public static event BackButtonPressedEventHandler BackPressed;
public event EventHandler ConfigurationChanged;
public override void OnBackPressed();
public override void OnConfigurationChanged(Configuration newConfig);
public override bool OnOptionsItemSelected(IMenuItem item);
public void SetStatusBarColor(global::Android.Graphics.Color color);
protected void LoadApplication(Application application);
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data);
protected override void OnCreate(Bundle savedInstanceState);
protected override void OnDestroy();
protected override void OnNewIntent(Intent intent);
protected override void OnPause();
protected override void OnRestart();
protected override void OnResume();
protected override void OnStart();
protected override void OnStop();
public delegate bool BackButtonPressedEventHandler(object sender, EventArgs e);
}
是否可以利用CoordinatorLayout
和AppBarLayout
?