i set floating button @ top right in xml design when run application device floating button doesn't right position. same position of xml design in device .
my xml design :
device show :
<android.support.v7.widget.cardview android:id="@+id/card_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:clickable="true" android:layout_margin="4dp" card_view:cardcornerradius="7dp" android:elevation="8dp" app:cardpreventcorneroverlap="false" > <linearlayout android:orientation="vertical" android:layout_width="152dp" android:layout_height="match_parent" android:weightsum="1" android:descendantfocusability="blocksdescendants"> <framelayout android:layout_width="match_parent" android:layout_height="wrap_content"> <imageview android:layout_width="match_parent" android:layout_height="100dp" android:scaletype="fitxy" app:srccompat="@drawable/draw_menu" android:id="@+id/imageprodcard" /> <android.support.design.widget.floatingactionbutton android:id="@+id/likebuttoncard" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="0dp" android:clickable="true" android:src="@drawable/heart" android:layout_gravity="right" app:borderwidth="0dp" app:fabsize="mini" app:layout_anchor="@id/imageprodcard" app:backgroundtint="#ffccbc" app:srccompat="@drawable/ic_favorite_border_black_24dps" /> </framelayout> <textview android:textappearance="?android:attr/textappearancesmall" android:text="textview" android:layout_width="match_parent" android:layout_height="25dp" android:id="@+id/nomprodtestcard" android:textallcaps="false" android:fontfamily="casual" android:textalignment="center" android:paddingleft="5dp" /> <linearlayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="16dp"> <textview android:textappearance="?android:attr/textappearancesmall" android:text="textview" android:layout_width="105dp" android:layout_height="20dp" android:id="@+id/prixprodtestcard" android:textcolor="@android:color/holo_red_light" android:textalignment="center" android:paddingleft="5dp" android:elevation="5dp" /> <textview android:layout_width="wrap_content" android:layout_height="match_parent" android:id="@+id/rating" android:layout_weight="777.07" /> <imageview android:layout_width="20dp" android:layout_height="match_parent" app:srccompat="@android:drawable/btn_star" android:id="@+id/imageview4" android:scaletype="fitstart" /> </linearlayout> <textview android:textappearance="?android:attr/textappearancesmall" android:text="textview" android:layout_width="match_parent" android:layout_height="20dp" android:id="@+id/qtestockcard" android:textstyle="normal|italic" android:textalignment="center" android:paddingleft="5dp" /> </linearlayout> </android.support.v7.widget.cardview>
use layout_gravity= right|bottom
, margin= "..."
, set floatingactionbutton in cardview
` or set in viewpager
Comments
Post a Comment