开发者

Android: Move Button Text to bottom

开发者 https://www.devze.com 2023-03-23 09:25 出处:网络
Currently I\'m creating a button with Image and Text. My problem is I want to move the text to teh buttom of the button.

Currently I'm creating a button with Image and Text. My problem is I want to move the text to teh buttom of the button.

<Button
  android:layout_weight=".30" 
  android:layout_margin="2dp" 
  android:background="@drawable/btnforgot" 
  android:layout_height="60dp" 
  android:layout_width="100dp" 
  android:text="Forgot "/>

Hope someone开发者_开发技巧 can help me out in this regard. Searched many places but couldn't come up with a solution.

Thanks in advance.


Simply add android:gravity="bottom|center" to your Button declaration. If you want to lift it from the bottom slightly, then add android:paddingBottom="4dp" as well.


I am not sure but android:gravity="bottom" can be helpful to you. Try this inside the <Button>.

Update:

If you want to know about android:gravity and android:layout_gravity then just check this SO question: Gravity and layout_gravity on Android


try android:layout_gravity="bottom" and android:gravity="bottom" properties....it will work.


Try with this :

android:layout_weight="0"

It works for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消