Ich habe das Layout wie folgt aus: Android Recycle Ansicht Symbolleiste aus öffnen Navigationsleiste auf 4.4.9 Gerät zu verhindern, arbeitet auf 6.0 Gerät
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/DrawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@color/backgroundColor">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:elevation="2dp"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:scrollbars="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/panic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:backgroundTint="@color/panicButton"
android:src="@drawable/ic_0005_panic_button_icon" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:fitsSystemWindows="true"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:id="@+id/nav_view"
app:headerLayout="@layout/header"
app:menu="@menu/navigationviewmenu" />
</android.support.v4.widget.DrawerLayout>
Und ein CardView dass Lasten im RecycleView wie folgt aussieht:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="@+id/card_view_elogs"
card_view:cardElevation="@dimen/card_elevation"
android:layout_gravity="center"
android:layout_width="@dimen/card_width"
android:layout_height="@dimen/card_height"
android:layout_marginLeft="@dimen/card_margin_left"
android:layout_marginTop="@dimen/card_margin_top"
card_view:cardBackgroundColor="@color/backgroundCard"
card_view:contentPaddingLeft="@dimen/card_content_padding_left"
card_view:contentPaddingTop="@dimen/card_content_padding_top">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:text="eDriver Logs"
android:layout_marginTop="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textViewHeaderElogsCard"
android:gravity="left"
android:textSize="16sp"
android:textColor="@color/cardHeader" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#333333"
android:id="@+id/textViewBodyElogsCard"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="4dp" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
public class MainActivity : AppCompatActivity
{
TypeFaceManager tfmanager;
protected int LayoutResource
{
get { return Resource.Layout.activity_navigationview; }
//get { return Resource.Layout.activity_drawerlayout; }
}
public Toolbar Toolbar { get; set; }
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(LayoutResource);
Toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
if (Toolbar != null)
{
SetSupportActionBar(Toolbar);
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
SupportActionBar.SetHomeButtonEnabled(true);
}
var panic = FindViewById<FloatingActionButton>(Resource.Id.panic);
panic.Click += PanicTouched;
RecyclerView recView = FindViewById<RecyclerView>(Resource.Id.recyclerView);
RecyclerView.LayoutManager llm = new GridLayoutManager(this, 1, GridLayoutManager.Horizontal, false);
recView.SetLayoutManager(llm);
tfmanager = new TypeFaceManager(this);
CardAdapter adapter = new CardAdapter(tfmanager.RobotoMedium);
recView.SetAdapter(adapter);
_drawerlayoutNav = FindViewById<DrawerLayout>(Resource.Id.DrawerLayout);
_toolbarNav = FindViewById<Toolbar>(Resource.Id.toolbar);
SetSupportActionBar(_toolbarNav);
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
SupportActionBar.Title = "PeopleNet Home"; // Testing
// Attach item selected handler to navigation view
var navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);
navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;
// Create ActionBarDrawerToggle button and add it to the toolbar
var drawerToggle = new ActionBarDrawerToggle(this,
_drawerlayoutNav, _toolbarNav,
Resource.String.drawer_open_accessibilitySupport, Resource.String.drawer_closed_accessibilitySupport);
_drawerlayoutNav.SetDrawerListener(drawerToggle);
drawerToggle.SyncState();
}
Die Schublade funktioniert, wenn ich auf die Werkzeugleiste auf einem 6.0-Gerät klicke, aber auf einem 4.4-Gerät verhindert die Recycler-Ansicht, dass die Schublade geöffnet wird. Irgendwelche Ideen?