如果音乐开始播放,则FloatingActionButton不可见 - SlideupPanelLayout

时间:2016-06-26 13:10:59

标签: android

FloatingActionButton运行良好,直到时间,音乐没有在应用程序中播放。我正在使用此library

问题出现在Android 6.0之前,它正常工作

当我点击制作按钮播放音乐时,开始移动滑动面板fab按钮变得不可见。

问题 - :

1-幻灯片动画效果不佳,拖动幻灯片布局停止工作。

2- Fab按钮不可见。

重要的是,一切顺利,直到音乐没有播放。

对于播放音乐,我正在使用后台服务。

内存问题或其他问题可能有任何问题吗?

以下是活动布局 -

    <com.sothree.slidinguppanel.FloatingActionButtonLayout
    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"
    xmlns:sothree="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    sothree:umanoFabMode="circular_reveal">
    <com.sothree.slidinguppanel.SlidingUpPanelLayout
        xmlns:sothree="http://schemas.android.com/apk/res-auto"
        android:id="@+id/sliding_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="bottom"
        sothree:umanoAnchorPoint="@+id/handle"
        sothree:umanoPanelHeight="58dp"
        sothree:umanoShadowHeight="4dp"
        sothree:umanoParallaxOffset="100dp"
        sothree:umanoDragView="@+id/trackdetails"
        sothree:umanoOverlay="true"
        sothree:umanoScrollableView="@+id/now_playlist">
        <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/drawer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            tools:context="com.ultimo.musicplayer.activity.MainActivity">
        <android.support.design.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <!--Main Content goes here-->
            <android.support.v4.view.ViewPager
                android:id="@+id/viewpager"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"  />
            <!--Toolbar and tabs-->
            <android.support.design.widget.AppBarLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:popupTheme="@style/PopupMenu"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                    app:layout_scrollFlags="scroll|enterAlways"/>
                <android.support.design.widget.TabLayout
                    android:id="@+id/tab_layout"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    app:tabGravity="fill"
                    sothree:tabIndicatorHeight="3dp"
                    app:tabMode="scrollable"
                    app:layout_scrollFlags="scroll|enterAlways"/>
            </android.support.design.widget.AppBarLayout>

        </android.support.design.widget.CoordinatorLayout>
            <android.support.design.widget.NavigationView
                android:id="@+id/navigation_view"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="start"
                app:menu="@menu/drawer"/>
        </android.support.v4.widget.DrawerLayout>
        <include layout="@layout/mediaplayer_layout"/>
    </com.sothree.slidinguppanel.SlidingUpPanelLayout>
    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab_play"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:src="@drawable/play"
        android:clickable="true"/>
</com.sothree.slidinguppanel.FloatingActionButtonLayout>

已在图书馆问题列表here上发布了问题。

1 个答案:

答案 0 :(得分:0)

我认为您创建的布局存在一些问题。我也在使用UmanoSlidingPanelLayout创建一个MusicPlayer。

试试这个。

<android.support.v4.widget.DrawerLayout 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/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start"
tools:context="com.ultimo.musicplayer.activity.MainActivity">

<com.sothree.slidinguppanel.FloatingActionButtonLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:sothree="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    sothree:umanoFabMode="circular_reveal">

    <com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
        android:id="@+id/sliding_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="bottom"
        sothree:umanoAnchorPoint="@+id/handle"
        sothree:umanoDragView="@+id/trackdetails"
        sothree:umanoOverlay="true"
        sothree:umanoPanelHeight="58dp"
        sothree:umanoParallaxOffset="100dp"
        sothree:umanoScrollableView="@+id/now_playlist"
        sothree:umanoShadowHeight="4dp">

        <android.support.design.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <!--Main Content goes here-->
            <android.support.v4.view.ViewPager
                android:id="@+id/viewpager"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_behavior="@string/appbar_scrolling_view_behavior" />
            <!--Toolbar and tabs-->
            <android.support.design.widget.AppBarLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:popupTheme="@style/PopupMenu"
                    app:layout_scrollFlags="scroll|enterAlways"
                    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

                <android.support.design.widget.TabLayout
                    android:id="@+id/tab_layout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_scrollFlags="scroll|enterAlways"
                    app:tabGravity="fill"
                    app:tabMode="scrollable"
                    sothree:tabIndicatorHeight="3dp" />
            </android.support.design.widget.AppBarLayout>

        </android.support.design.widget.CoordinatorLayout>

        <include layout="@layout/mediaplayer_layout" />
    </com.sothree.slidinguppanel.SlidingUpPanelLayout>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab_play"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:clickable="true"
        android:src="@drawable/play" />
</com.sothree.slidinguppanel.FloatingActionButtonLayout>

<android.support.design.widget.NavigationView
    android:id="@+id/navigation_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    app:menu="@menu/drawer" />

</android.support.v4.widget.DrawerLayout>