currently code places button @ bottom of screen:
<relativelayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="bottom" android:layout_alignparentbottom="true"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center|bottom"> <imagebutton android:id="@+id/button1" android:layout_width="95dp" android:layout_height="95dp" android:layout_centerinparent="true" android:gravity="center" android:src="@drawable/main_button" /> </linearlayout> </relativelayout>
however, wish align below bottom of screen, small part of button clipped off (say, 20%). ultimately, end result when tap , drag button up, move , reveal entire button, before that, bottom part of clipped.
there many questions on how align button bottom of screen, can't seem find aligns below bottom of screen.
is there way so, or not using correct search terms?
edit: answers, tried android:translationy="20dp" , did not work, tried android:layout_marginbottom="-20dp" , worked me.
you can add android:translationy="xdp"
button move down x dp.
alternatively can create 2 linearlayouts
. 1 fill screen , hold other components , contains button. can add android:layout_below="@id/layout0"
, android:margin_top="xdp"
control how far below screen layout button should be.
<relativelayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="bottom" android:layout_alignparentbottom="true"> </linearlayout android:id="@+id/layout0" android:layout_width="match_parent" android:layout_height="match_parent"/> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:layout_below="@id/layout0" android:margin_top="xdp" android:gravity="center|bottom"> <imagebutton android:id="@+id/button1" android:layout_width="95dp" android:layout_height="95dp" android:layout_centerinparent="true" android:gravity="center" android:src="@drawable/main_button"/> </linearlayout> </relativelayout>