'TextView margins not working inside LinearLayout
I have this simple xml below. The problem is that none of the layout_marginLeft, layout_marginRight, layout_marginTop or layout_marginBottom work. But layout_margin works!
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp" <-- does not work
android:layout_marginTop="16dp" <-- does not work
android:text="This is a text!"
/>
</LinearLayout>
Also, I noticed that when I add an incomplete layout_margin="0" (without dp) it causes an error but the marginLeft, marginRight, etc. work! But then I have an error and it will not compile. What is going on here?!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
