Search code examples
androidxmlandroid-studiofloating-action-buttonandroidx

Android resource linking failed when using layout_gravity="bottom||end" xml


I tried to put my FAB on the Bottom right side of the screen. But every time I build the app, it always fail with AAPT error if I'm using the android:layout_gravity="bottom||end"

Here is the detailed error: Android resource linking failed

AAPT: error: 'bottom||end' is incompatible with attribute layout_gravity (attr) flags [bottom=80, center=17, center_horizontal=1, center_vertical=16, clip_horizontal=8, clip_vertical=128, end=8388613, fill=119, fill_horizontal=7, fill_vertical=112, left=3, right=5, start=8388611, top=48].

And I've tried to use android:layout_gravity="bottom" and it works just fine.

can someone help me with this?


Solution

  • Use

    android:layout_gravity="bottom|end"
    

    instead of

    android:layout_gravity="bottom||end"