Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

android-gravity

Change gravity of image drawable in textview

September 3, 2023 by Tarik

Try using android:gravity=”top” if it didnt work then go with negative margin like this android:drawablePadding=”-20sp” Another alternative way is to take an ImageView beside TextView inside LinearLayout so you can apply gravity

Categories android Tags android, android-drawable, android-gravity, android-layout, textview Leave a comment

What is the difference between gravity and layout_gravity in Android?

August 29, 2022 by Tarik

Their names should help you: android:gravity sets the gravity of the contents (i.e. its subviews) of the View it’s used on. android:layout_gravity sets the gravity of the View or Layout relative to its parent. And an example is here.

Categories android Tags android, android-gravity, android-layout Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa