Solution 1 :
Instead of relying on padding, I suggest you to learn ConstraintLayout. This layout is most widely used these days. It sets constraints (like rules) for parent layout and your components. It is much better than padding, which needs to be set differently for different screen sizes and densities.
To use ConstraintLayout, follow these steps:
- Put your
TextView
andImageView
underConstraintLayout
. - Select both of them and Right Click.
- Select
Chains
->Create Horizontal Chain
.
This set constraints on both of the components and they will never overlap.
For in-depth understanding of ConstraintLayout, check:
- ConstraintLayout (Google Documentations)
- Exploring the new Android ConstraintLayout (Medium Tutorials)
Problem :
Comments
Comment posted by Shweta Chauhan
how you add that image? using drawable right? Please add your code for more detail
Comment posted by stackoverflow.com/questions/32609710/…
check this:
Comment posted by Shivam Singh
upload your Xml code