Xamarin.Android Snackbar和FAB错误

时间:2017-04-11 17:16:31

标签: android xamarin.android floating-action-button snackbar

如果我尝试通过点击浮动操作按钮来调用快餐栏,则会收到错误消息。

这是我收到的错误消息:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/drawer">
 <LinearLayout 
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:padding="10dip">
   <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
     <EditText
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:hint="First Name" />
   </android.support.design.widget.TextInputLayout>
   <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
      <EditText
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:hint="Last Name" />
   </android.support.design.widget.TextInputLayout>
  </LinearLayout>
 <android.support.design.widget.FloatingActionButton
        android:id="@+id/ActionButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end|bottom"
        android:layout_margin="10dip"
        app:backgroundTint="@android:color/holo_green_light"
        android:src="@drawable/icon" />
 </android.support.design.widget.CoordinatorLayout>

使用NavigationView它工作正常,但我想让它在没有导航视图的情况下运行

这是我的代码:

Main.axml

using Android.App;
using Android.OS;
using Android.Widget;
using Android.Support.Design.Widget;
using Android.Support.V4.Widget;
using Android.Support.V7.App;
using toolbar = Android.Support.V7.Widget.Toolbar;

namespace FloatingActionButtonExample
{
    [Activity(Label = "FloatingActionButtonExample", MainLauncher = true, Icon = "@drawable/icon", Theme = "@style/Theme.AppCompat.Light.DarkActionBar")]
    public class MainActivity : AppCompatActivity
    {


        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);

            var container = FindViewById<CoordinatorLayout>(Resource.Id.drawer);
            var actionButton = FindViewById<FloatingActionButton>(Resource.Id.ActionButton);

            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SupportActionBar.SetHomeButtonEnabled(false);

            actionButton.Click += (sender, e) =>
                Snackbar.Make(container, "FAB Tapped!", Snackbar.LengthLong)
                    .SetAction("Action", view =>
                        Toast.MakeText(this, "Action tapped!", ToastLength.Short).Show())
                    .Show();
        }

    }
}

MainActivity.cs

from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from selenium.common import exceptions
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver import ActionChains
driver = webdriver.Chrome()
driver.get("http://html5demos.com/drag")
dragElement=driver.find_element_by_id("one")
dropElement=driver.find_element_by_id("bin")

action_chains = ActionChains(driver)
action_chains.drag_and_drop(dragElement, dropElement).perform()

我尝试了很多选择,但对我没什么用。

0 个答案:

没有答案