ScalableTabIndicator
ScalableTabIndicator copied to clipboard
这个没做适配?
我在模拟器中测试1080*1920, 你会发现 该控件是固定死了的长度,没做适配么
控件的宽高是通过 你继承Tab类自己的实现的
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int height = MeasureSpec.makeMeasureSpec(getMeasuredHeight() - getPaddingBottom() - getPaddingTop(), MeasureSpec.EXACTLY);
for (int i = 0; i < tabs.size(); i++) {
tabs.get(i).getView().measure(MeasureSpec.UNSPECIFIED, height);
}
}
所以宽度是没有限制的
我指的是 在ScalableTabIndicator中均分 tabs的宽度, 我设置当前设置了 6个 tabs ,不同的屏幕的 会不一样,- - 如何解决? 继承Tab类不行啊
你需要继承Tab,然后Tab里面有一个getView() 的方法,这个就是你需要让他显示的view,你看demo里面的TabView1,2,3 例子,宽是由Tab中的getView()拿到的宽的总和加起来的(允许滚动的情况下)
谢谢回复,回头仔细搞下。