taltstidl / AndroidSlidingUpPanel

This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.
http://umano.me
Apache License 2.0
13 stars 6 forks source link

FAB layout_gravity not working ? #16

Closed mathieudebrito closed 9 years ago

mathieudebrito commented 9 years ago

Hi, (first of, thx for this fork, it's really awesome !)

I tried to set layout_gravity to the fab and it doesn't work. the position is alway bottom|right. I tried with bottom|center, bottom|left and bottom|center_horizontal but nothing changes. Any idea please ?

here is my code:

<?xml version="1.0" encoding="utf-8"?>
<com.sothree.slidinguppanel.FloatingActionButtonLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:auto="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    auto:umanoFabMode="fade">

    <com.sothree.slidinguppanel.SlidingUpPanelLayout
        android:id="@+id/sliding_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/common_transparent"
        android:gravity="bottom"
        auto:umanoFadeColor="@color/common_transparent"
        auto:umanoPanelHeight="@dimen/map_sliding_header_height"
        auto:umanoParalaxOffset="250dp"
        auto:umanoShadowHeight="4dp">

        // some stuff

    </com.sothree.slidinguppanel.SlidingUpPanelLayout>

    <com.melnykov.fab.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:layout_gravity="center"
        android:layout_marginBottom="16dp"
        android:scaleType="fitCenter"
        android:src="@drawable/ic_add"
        auto:fab_colorNormal="@color/geovelo_blue"
        auto:fab_colorPressed="@color/geovelo_blue"
        auto:fab_colorRipple="@color/common_white" />

</com.sothree.slidinguppanel.FloatingActionButtonLayout>
taltstidl commented 9 years ago

@mathieudebrito Currently the FloatingActionButtonLayout doesn't support using gravity, it just puts it in the bottom right corner. Since it's rather useful I'll add support for gravity as soon as I can. I'm studying for a test right now so you might have to wait till the end of next week at the latest.

mathieudebrito commented 9 years ago

Sure ! no pb. In the meanwhile, here is my workaround :

I just put the FAB in a RelativeLayout, and it works almost like a charm :p

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <!-- FLOATING ACTION BUTTON -->
        <com.melnykov.fab.FloatingActionButton
            android:id="@+id/fab"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_centerInParents="true"
            android:layout_marginBottom="25dp"
            android:layout_marginRight="50dp"
            android:scaleType="fitCenter"
            android:src="@drawable/ic_navigation"
            android:tint="@color/geovelo_blue"
            auto:fab_colorNormal="@color/common_white"
            auto:fab_colorPressed="@color/common_white"
            auto:fab_colorRipple="@color/geovelo_blue_disabled" />
    </RelativeLayout>

Best wishes for your test !

taltstidl commented 9 years ago

@mathieudebrito Thanks :)

taltstidl commented 9 years ago

@mathieudebrito This issue has been fixed in the latest release. You'll just have to change the version number in your build.gradle from 3.1.0 to 3.1.1. Thanks for reporting the issue and enjoy :)

mathieudebrito commented 9 years ago

Perfect thx :) Hope you rocked your test !