先看一下代码
textView.setLayoutParams(new TextSwitcher.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
为什么要用TextSwitcher的LayoutParams呢。查一查API,可以看到这么一句话These supply parameters to the
parent of this view specifying how it should be arranged。也就是说一定要用父控件的LayoutParams。如果父控件是LinearLayout,当然就必须写成LinearLayout.LayoutParams
TextSwitcher LayoutParams 使用解析
本文探讨了在使用TextSwitcher控件时为何需要采用其特有的LayoutParams,并解释了LayoutParams的作用在于定义视图如何在父容器中布局。通过具体代码示例说明了正确设置LayoutParams的重要性。
1229

被折叠的 条评论
为什么被折叠?



