Reputation: 9396
I would like to set to my EditText background .
Hm ... I don't know even how to explain .... When there is a lot of text vertical scroll enables ... I need to 'scroll' the background when user scrolls the text (Now I have that when user scrolls the text background is fixed, so text became crossed by lines of background)
Have you any ideas?
Upvotes: 2
Views: 5904
Reputation: 9993
Create a drawable in xml like this for lines as mybackground.xml, where @drawable/divider will be your line image with the prefered space between lines
<bitmap android="http://schemas.android.com/apk/res/android"
android:src="@drawable/divider"
android:tileMode="repeat"
android:dither="true"
/>
and set the following attributes in EditText control to adjust the
android:background="@drawable/mybackground"
android:lineSpacingExtra="Your Value"
android:lineSpacingMultiplier="Your Value"
Upvotes: 3
Reputation: 39604
You might want to give lineSpacingExtra and lineSpacingMultiplier a try and then try to adjust the background image to it so it all fits as desired. Alternatively you can also try to play around with a 9-patch image and get it to repeat as desired but I'm not sure is this is going to work that way. Those are two options to try out maybe I can come up with more at a later point.
EDIT: It won't work with 9-patches.
Upvotes: 0