xmartlabs / XLPagerTabStrip

Android PagerTabStrip for iOS.
MIT License
6.97k stars 1.33k forks source link

Is there anyway to change selectedBar width? #795

Open ubersexual opened 4 years ago

ubersexual commented 4 years ago

Hi . Is there anyway to change selectedBar width? I want a shorter selectbar

WessonWu commented 4 years ago

You can add a custom selected bar like this:

        let rect = CGRect(x: 0, y: 0, width: 16, height: 2)
        let customSelectedBar = ShapeView(frame: rect)
        customSelectedBar.shapeLayer.path = UIBezierPath(roundedRect: rect, cornerRadius: 2).cgPath
        customSelectedBar.shapeLayer.fillColor = Color.primaryColor.cgColor
        buttonBarView.selectedBar.addSubview(customSelectedBar)
        customSelectedBar.snp.makeConstraints {
            $0.size.equalTo(rect.size)
            $0.centerX.bottom.equalToSuperview()
        }
HKevin1993 commented 3 years ago

you can override "updateSelectedBarPosition" the function of ButtonBarView. Adjust the "selectedBarFrame.size.width = selectedCellFrame.size.width" and "selectedBarFrame.origin.x = selectedCellFrame.origin.x". 截屏2020-11-25 下午12 28 12

RealFeeling commented 3 years ago

Have any progerss?