https://github.com/trinnguyen/android-segmentview
Simple Segment Control cloned from iOS 13 for Android Native (Java) and Xamarin.Android (C#)
https://github.com/trinnguyen/android-segmentview
android segmentcontrol segmentview
Last synced: 21 days ago
JSON representation
Simple Segment Control cloned from iOS 13 for Android Native (Java) and Xamarin.Android (C#)
- Host: GitHub
- URL: https://github.com/trinnguyen/android-segmentview
- Owner: trinnguyen
- Created: 2019-12-09T20:34:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-20T16:24:13.000Z (about 5 years ago)
- Last Synced: 2025-03-19T16:07:33.001Z (about 1 month ago)
- Topics: android, segmentcontrol, segmentview
- Language: Java
- Homepage:
- Size: 221 KB
- Stars: 6
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## SegmentView
[](https://www.nuget.org/packages/Xamarin.SegmentView/)Simple Android Segment Control cloned from iOS 13
## Usage in Android Gradle Module using JitPack.io
- Add it in your root `build.gradle` at the end of repositories:
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```- Add the dependency to module's build.gradle
```
dependencies {
....
implementation 'com.github.trinnguyen:Android-SegmentView:master-SNAPSHOT'
}
```## XML layout code
```xml```
## Usage in Android
### Update title
```java
SegmentView segmentView = findViewById(R.id.segment_2);
segmentView.setText(0, "Map");
segmentView.setText(1, "Transit");
segmentView.setText(2, "Satellite");
```### Listener
```
@Override
protected void onStart() {
super.onStart();
segmentView.setOnSegmentItemSelectedListener(this);
}@Override
protected void onStop() {
super.onStop();
segmentView.setOnSegmentItemSelectedListener(null);
}
```## Usage in Xamarin.Android
### Nuget
```
dotnet add package Xamarin.SegmentView
```### Update title
```java
SegmentView segmentView = FindViewById(Resource.Id.segment_2);
segmentView.SetText(0, "Map");
segmentView.SetText(1, "Transit");
segmentView.SetText(2, "Satellite");
```### Listener