What I want to do is add some top margin/padding before THE TEXT, and not for the entire container:
<EditText android:id="@+id/mightyText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|top"
android:inputType="textAutoComplete|textMultiLine"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingBottom="80dp"
android:background="#fff" />
Once it's on top it works great. I have equal paddings for sides and top...
...but when I scroll, the padding stays glued to the container instead of going up with the text
How do I change it, so it scrolls with the text instead of always being visible?
Put it in ScrollView, which will automatically take care of the scroll. EditText won't be responsible for that, so his padding will work as you wish. Try the code below:
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText android:id="@+id/mightyText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left|top"
android:inputType="textAutoComplete|textMultiLine"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingBottom="80dp"
android:background="#fff" />
</ScrollView>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With