Search code examples
androidshapesmaterial-designlayer-listfloating-action-button

Android button looks different after rotating to landscape and still after rotating back


I created my button following this tutorial. It looks pretty good.

But if I rotate my device screen to landscape, the button looks different. Do you have some idea, why this is happening? If you need some code, please let me know!

Button as it should:

Button as it should

Button as it after rotating:

Button as it after rotating


Solution

  • I suggest to you to use FloatingActionButton included in Android Design Support Library.

    Simply add compile 'com.android.support:design:22.2.0' to your Gradle file, and use the FloatingActionBar view class into your layout!

    Example:

    <android.support.design.widget.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:src="@drawable/your_drawable" />