使用Android支持设计库我想从下到上更改TabLayout.SlidingTabStrip位置。问题是SlidingTabStrip是私有类,所以我找不到扩展它并覆盖其draw方法的好方法。
所以为了简化我想改变第二行这个方法:
public void draw(Canvas canvas) {
super.draw(canvas);
if(this.mIndicatorLeft >= 0 && this.mIndicatorRight > this.mIndicatorLeft) {
canvas.drawRect((float)this.mIndicatorLeft, (float)(this.getHeight() - this.mSelectedIndicatorHeight), (float)this.mIndicatorRight, (float)this.getHeight(), this.mSelectedIndicatorPaint);
}
}
来自:
canvas.drawRect((float)this.mIndicatorLeft, (float)(this.getHeight() - this.mSelectedIndicatorHeight), (float)this.mIndicatorRight, (float)this.getHeight(), this.mSelectedIndicatorPaint);
进入这个方法:
canvas.drawRect((float)this.mIndicatorLeft, 0f, (float)this.mIndicatorRight, (float)this.selectedIndicatorHeight, this.mSelectedIndicatorPaint);
我怎样才能做到这一点? 谢谢。
答案 0 :(得分:-1)
使用android.support.design.widget.TabLayout并覆盖其onDraw(Canvas画布)