开发者

android EditText's background

开发者 https://www.devze.com 2023-01-25 04:33 出处:网络
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 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开发者_StackOverflow社区 you any ideas?


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" 


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消