mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat: add css support for tabs widget (#7491)
This commit is contained in:
committed by
Manol Donev
parent
aed1daa8f5
commit
30fc585425
@@ -284,6 +284,10 @@ public class TabLayout extends HorizontalScrollView {
|
||||
textView.setVisibility(GONE);
|
||||
}
|
||||
|
||||
if (tabItem.backgroundColor != 0) {
|
||||
ll.setBackgroundColor(tabItem.backgroundColor);
|
||||
}
|
||||
|
||||
if (imgView.getVisibility() == VISIBLE && textView.getVisibility() == VISIBLE) {
|
||||
ll.setMinimumHeight((int) (LARGE_MIN_HEIGHT * density));
|
||||
} else {
|
||||
@@ -297,6 +301,14 @@ public class TabLayout extends HorizontalScrollView {
|
||||
}
|
||||
}
|
||||
|
||||
public void onTap(int position) {
|
||||
// to be overridden in JS
|
||||
}
|
||||
|
||||
public void onSelectedPositionChange(int position, int prevPosition) {
|
||||
// to be overridden in JS
|
||||
}
|
||||
|
||||
private void populateTabStrip() {
|
||||
final PagerAdapter adapter = mViewPager.getAdapter();
|
||||
final OnClickListener tabClickListener = new TabClickListener();
|
||||
@@ -370,6 +382,8 @@ public class TabLayout extends HorizontalScrollView {
|
||||
return;
|
||||
}
|
||||
|
||||
int prevPosition = mTabStrip.getSelectedPosition();
|
||||
onSelectedPositionChange(position, prevPosition);
|
||||
mTabStrip.onViewPagerPageChanged(position, positionOffset);
|
||||
|
||||
View selectedTitle = mTabStrip.getChildAt(position);
|
||||
@@ -411,6 +425,7 @@ public class TabLayout extends HorizontalScrollView {
|
||||
public void onClick(View v) {
|
||||
for (int i = 0; i < mTabStrip.getChildCount(); i++) {
|
||||
if (v == mTabStrip.getChildAt(i)) {
|
||||
onTap(i);
|
||||
mViewPager.setCurrentItem(i);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user