问题
Here is what it looks like in the beginning when I haven't added any imagespan chips -
As you can tell there the cursor is placed at the right size and the gravity is respected.
Then when I add an imagespan, the cursor all of a sudden becomes bigger like this -
I don't understand why this happens and I also don't know how to fix it, i.e. keep the cursor the same size.
Finally when I start typing again, the cursor is all wierd while maintaining the size of the of the font and the span also moves a little to the bottom. I really want to the keep the cursor the same size and keep it centered
I'm aware of textCursorDrawable sizing using padding. There are two potential problems with that - 1. Its API 12+ (We support 9 and above), this isnt a big deal though 2. I couldnt find a way to reset it programmatically, only saw access to it in the xml definition.
Any ideas?
回答1:
Chances are the ImageSpan changes the lineheight after it's added. If you set a line height bigger than the imagespan, I have a feeling your cursor will remain constant size (but still large). At this point you can add padding to shrink it down to the smaller size you want and it should remain constant.
(I don't have a chance to test what I just wrote, so it's just a theory)
来源:https://stackoverflow.com/questions/21706567/how-can-i-prevent-the-cursor-from-resizing-in-an-edittext-multiautocompletetext