A custom Tab.
Sample of animation
Images
| Extend to | int |
|---|---|
| Top | 0 |
| Bottom | 1 |
| Left | 2 |
| Right | 3 |
<com.yl.widgets.extendabletabview.ExtendableTabView
android:id="@+id/extendableTabView"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:orientation_selector="2"
app:orientation_extend="0"
app:tab_width="25dp"
app:tab_height="40dp"/>LinearLayout ll_basic = (LinearLayout) getLayoutInflater().inflate(R.layout.tab_basic, null);
final TextView tv_textSize_hint = ll_basic.findViewById(R.id.tab_basic_textSize_hint);
SeekBar seekBar = ll_basic.findViewById(R.id.tab_basic_textSize);
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tv_textSize_hint.setText(String.valueOf(progress) + "sp");
((TextView) findViewById(R.id.main_text)).setTextSize(TypedValue.COMPLEX_UNIT_SP, progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) { }
@Override
public void onStopTrackingTouch(SeekBar seekBar) { }
});
ExtendableTabView tab = findViewById(R.id.extendableTabView);
ArrayList<String> strs = new ArrayList<String>();
strs.add("BASIC");
strs.add("90");
strs.add("100");
ArrayList<LinearLayout> lls = new ArrayList<>();
lls.add(ll_basic);
lls.add(null);
lls.add((LinearLayout) View.inflate(getApplicationContext(), R.layout.sample_body_3, null));
/* .addItem(String title, LinearLayout LinearLayoutlinearLayout)
* .addItems(ArrayList<String>, ArrayList<LinearLayout>)
*/
tab.addItems(strs, lls);
// or (for add one item): tab.addItem("BASIC", ll_basic)
// OnEventListener
tab.setOnEventListener(new ExtendableTabView.OnEventListener() {
@Override
public void onExtended() {
Log.i(TAG, "onExtended: ");
}
@Override
public void onCollapsed() {
Log.i(TAG, "onCollapsed: ");
}
@Override
public void onItemClicked(View view) {
Log.i(TAG, "onItemClicked: "+
((TextView)view).getText());
}
});allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
...
implementation 'com.github.FaDrYL:ExtendableTabView:0.5.4.1'
}
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.FaDrYL</groupId>
<artifactId>ExtendableTabView</artifactId>
<version>0.5.4.1</version>
</dependency>



