How can I add a text under a FAB in android -
i'm working on app android , need put text under fab (floating action button) so:
but every time i'm trying use linearlayout or relativelayout it, fab sets random location , it's not need be.
i can't post of code layout because has details can't share (i'm under contract , not public project). if need specific let me know , i'll find way share without revealing anything.
edit: need fab because after click on on layout should this: fab after click
and if click on picture, goes different page
are using coordinatorlayout set position of fab?
here's example how can that.
<android.support.design.widget.coordinatorlayout android:id="@+id/main_content" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- content --> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" app:layout_anchor="@id/main_content" app:layout_anchorgravity="bottom|right|end"> <android.support.design.widget.floatingactionbutton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right" android:layout_margin="16dp" android:src="@mipmap/ic_launcher"/> <-- put here textview --> </linearlayout> </android.support.design.widget.coordinatorlayout>
edit: change anchorgravity
coordinatorlayout.layoutparams p = (coordinatorlayout.layoutparams) fab.getlayoutparams(); p.setanchorid(xxxx); fab.setlayoutparams(p);
Comments
Post a Comment