开发者

getting rid of extra space in text switcher

开发者 https://www.devze.com 2023-01-12 22:06 出处:网络
I have an activity that extends ViewFactory. The activity does nothing more than act as documentati开发者_高级运维on for my app, with 5 different \'views\'.

I have an activity that extends ViewFactory. The activity does nothing more than act as documentati开发者_高级运维on for my app, with 5 different 'views'.

Each view is placed inside a ScrollView in a TextSwitcher. The problem that I am facing is that if one of the five views has more text than the next view, there is empty scroll space.

Any ideas on how I can get rid of this space?

Thanks!


TextSwitcher, as any ViewSwitcher/ViewAnimator will size to the largest child size by default.

This can be changed by setting the MeasureAllChildren property to false, e.g.:

TextSwitcher switcher = (TextSwitcher)findViewById(R.id.textSwitcher);
switcher.setMeasureAllChildren(false);

Then the size will be adjusted to the visible child on layout.

0

精彩评论

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