本文整理匯總了Java中android.widget.LinearLayout.getHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java LinearLayout.getHeight方法的具體用法?Java LinearLayout.getHeight怎麽用?Java LinearLayout.getHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.getHeight方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
示例2: getChildHeight
import android.widget.LinearLayout; //導入方法依賴的package包/類
public int getChildHeight(CustomScrollView scrollView)
{
LinearLayout ll = (LinearLayout) scrollView.getChildAt(0);
return ll.getHeight()/ll.getChildCount();
}