문제

I can not find any related layout implementation in android build in layouts.

I found one implementation in this post, Line-breaking widget layout for Android, but in that post's case, there is a precondition that the child's width is not wider than the parent's.

But in my case, the child's width is wider than the parent's. Like say, there is one textview and one image in the layout, the layout's width is 200, while the textview's whole width is 300, and the image's width is 50.

Any build-in implementation in android for this ? Or any suggestion about how to implement this layout by myself ?

Thanks.

도움이 되었습니까?

해결책 2

I found the solution, which is to use ImageSpan, and then invoked SpannableStringBuilder.setSpan method.

다른 팁

But in my case, the child's width is wider than the parent's.

That is mathematically impossible.

Like say, there is one textview and one image in the layout, the layout's width is 200, while the textview's whole width is 300, and the image's width is 50.

That is mathematically impossible. Your layout's width has to be at least as large as its largest child.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top