MainActivity code for segmented controll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example.com.segmentedcontrollsupport | |
import android.support.v7.app.AppCompatActivity | |
import android.os.Bundle | |
import segmented_control.widget.custom.android.com.segmentedcontrol.SegmentedControl | |
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
val segmentedControl = findViewById<SegmentedControl<String>>(R.id.segmented_control) | |
segmentedControl.setOnSegmentSelectRequestListener { | |
// do not perform select for first item | |
return@setOnSegmentSelectRequestListener it.absolutePosition != 0 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment