本文整理汇总了Java中android.widget.LinearLayout.getVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java LinearLayout.getVisibility方法的具体用法?Java LinearLayout.getVisibility怎么用?Java LinearLayout.getVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.getVisibility方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setColorPreview
import android.widget.LinearLayout; //导入方法依赖的package包/类
public void setColorPreview(LinearLayout colorPreview, Integer selectedColor) {
if (colorPreview == null)
return;
this.colorPreview = colorPreview;
if (selectedColor == null)
selectedColor = 0;
int children = colorPreview.getChildCount();
if (children == 0 || colorPreview.getVisibility() != View.VISIBLE)
return;
for (int i = 0; i < children; i++) {
View childView = colorPreview.getChildAt(i);
if (!(childView instanceof LinearLayout))
continue;
LinearLayout childLayout = (LinearLayout) childView;
if (i == selectedColor) {
childLayout.setBackgroundColor(Color.WHITE);
}
ImageView childImage = (ImageView) childLayout.findViewById(R.id.image_preview);
childImage.setClickable(true);
childImage.setTag(i);
childImage.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (v == null)
return;
Object tag = v.getTag();
if (tag == null || !(tag instanceof Integer))
return;
setSelectedColor((int) tag);
}
});
}
}
示例2: hidePages
import android.widget.LinearLayout; //导入方法依赖的package包/类
protected void hidePages()
{
LinearLayout pages = (LinearLayout) findViewById(R.id.pages_container);
if (null == pages)
return;
if (pages.getVisibility() == View.GONE)
return;
pages.setVisibility(View.GONE);
ViewTreeObserver observer = mDocView.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
{
@Override
public void onGlobalLayout()
{
mDocView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
mDocView.onHidePages();
}
});
}
示例3: toggleVoltageAdjustmentControls
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void toggleVoltageAdjustmentControls(View rootView) {
boolean isEnabled = AppState.getInstance().isLiPoMonitorEnabled;
LinearLayout layout = (LinearLayout) rootView.findViewById(R.id.adjustmentLayout);
boolean isVisible = layout.getVisibility() == View.VISIBLE;
if (!isVisible) {
if (isEnabled) {
layout.setVisibility(View.VISIBLE);
}
} else {
layout.setVisibility(View.GONE);
}
}
示例4: showPages
import android.widget.LinearLayout; //导入方法依赖的package包/类
protected void showPages()
{
LinearLayout pages = (LinearLayout) findViewById(R.id.pages_container);
if (null == pages)
return;
if (pages.getVisibility() == View.VISIBLE)
return;
pages.setVisibility(View.VISIBLE);
final ViewTreeObserver observer = mDocView.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
{
@Override
public void onGlobalLayout()
{
observer.removeOnGlobalLayoutListener(this);
mDocView.onShowPages();
}
});
final ViewTreeObserver observer2 = getViewTreeObserver();
observer2.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
{
@Override
public void onGlobalLayout()
{
observer2.removeOnGlobalLayoutListener(this);
mDocPagesView.onOrientationChange();
int page = mDocView.getMostVisiblePage();
mDocPagesView.setCurrentPage(page);
mDocPagesView.scrollToPage(page);
}
});
}