小编hjc*_*hin的帖子

BottomNavigationView在CoordinatorLayout中重叠FrameLayout

以下是我的布局xml.现在的问题是BottomNavigationView与FrameLayout重叠.我希望FrameLayout延伸到BottomNavigationView的顶部.

我尝试使用技巧,例如在FrameLayout中添加paddingBottom,但我想知道是否还有其他更好的解决方案.谢谢.

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <include layout="@layout/user_app_bar"/>

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="?android:attr/windowBackground"
        app:menu="@menu/navigation"
        app:itemTextColor="@color/colorPrimaryDark"
        app:itemIconTint="@color/colorPrimaryDark"
        />

    <FrameLayout
        android:id="@+id/fragment_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="58dp"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

   <android.support.design.widget.FloatingActionButton
       android:id="@+id/fab"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_margin="@dimen/fab_margin"
       app:layout_anchorGravity="bottom|end"
       app:layout_anchor="@id/app_bar"
       app:srcCompat="@drawable/ic_edit_white_24px" />

</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

更新:有关user_app_bar.xml的更多信息.它包含一个CollapsingToolbarLayout.

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/app_bar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay"
    app:layout_behavior="co.domain.DisableAppBarLayoutBehaviour"
    >

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/toolbar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        app:titleEnabled="false"
        app:contentScrim="?attr/colorPrimary">

        <android.support.constraint.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_collapseMode="parallax">

            <ImageView
                android:id="@+id/backdrop"
                android:layout_width="match_parent"
                android:layout_height="250dp"
                android:layout_marginBottom="0dp"
                android:layout_marginLeft="0dp"
                android:layout_marginRight="0dp"
                android:layout_marginTop="0dp"
                android:contentDescription=""
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintHorizontal_bias="0.0"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toRightOf="parent" …
Run Code Online (Sandbox Code Playgroud)

android coordinator-layout bottomnavigationview

10
推荐指数
3
解决办法
5835
查看次数

仅在生产中发生的 La​​ravel“调用未定义方法”

我有 2 个控制器函数,它们调用位于 app 文件夹下的类的静态函数。

控制器\UserResController.php

public function show($id, Request $request)
{
   return \App\User::show($id, $request);
}
Run Code Online (Sandbox Code Playgroud)

控制器\其他\UserResController.php

public function show($id, Request $request)
{
   // other codes

   return \App\User::show($id, $request);
}
Run Code Online (Sandbox Code Playgroud)

应用\用户.php

public static function show($id, Request $request){
   //codes
}
Run Code Online (Sandbox Code Playgroud)

令我惊讶的是,这些代码在开发和登台环境中运行良好,但在生产环境中却没有。

它抛出异常 'Symfony\Component\Debug\Exception\FatalErrorException' 并带有消息 'Call to undefined method App\User::show()'

是什么原因造成的?谢谢。

php symfony laravel

5
推荐指数
1
解决办法
8327
查看次数