本文整理汇总了Java中android.widget.LinearLayout.getTop方法的典型用法代码示例。如果您正苦于以下问题:Java LinearLayout.getTop方法的具体用法?Java LinearLayout.getTop怎么用?Java LinearLayout.getTop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.getTop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scrollToTab
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void scrollToTab(int tabIndex, float positionOffset) {
final int tabStripChildCount = tabStrip.getChildCount();
if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) {
return;
}
LinearLayout selectedTab = (LinearLayout) getTabAt(tabIndex);
if (0f <= positionOffset && positionOffset < 1f) {
if(!tabLayoutState){
ImageView imageView = (ImageView) selectedTab.getChildAt(0);
((RevealDrawable)imageView.getDrawable()).setOrientation(RevealDrawable.VERTICAL);
imageView.setImageLevel((int) (positionOffset * 5000 + 5000));
}
if(flag){
ChangeTextView textView = (ChangeTextView) selectedTab.getChildAt(1);
textView.setLevel((int) (positionOffset * 5000 + 5000));
}
}
if(!(tabIndex + 1 >= tabStripChildCount)){
LinearLayout tab = (LinearLayout) getTabAt(tabIndex + 1);
if(!tabLayoutState){
ImageView img = (ImageView) tab.getChildAt(0);
((RevealDrawable)img.getDrawable()).setOrientation(RevealDrawable.VERTICAL);
img.setImageLevel((int) (positionOffset * 5000));
}
if(flag){
ChangeTextView text = (ChangeTextView) tab.getChildAt(1);
text.setLevel((int) (positionOffset * 5000));
}
}
int titleOffset = tabViewHeight * 2;
int extraOffset = (int) (positionOffset * selectedTab.getHeight());
int y = (tabIndex > 0 || positionOffset > 0) ? -titleOffset : 0;
int start = selectedTab.getTop();
y += start + extraOffset;
scrollTo(0, y);
}