本文整理匯總了Java中android.support.v7.widget.ActionMenuView.getChildCount方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionMenuView.getChildCount方法的具體用法?Java ActionMenuView.getChildCount怎麽用?Java ActionMenuView.getChildCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.widget.ActionMenuView
的用法示例。
在下文中一共展示了ActionMenuView.getChildCount方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onGlobalLayout
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
private void onGlobalLayout() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
mToolbar.getViewTreeObserver().removeOnGlobalLayoutListener(mOnGlobalLayoutListener);
else
mToolbar.getViewTreeObserver().removeGlobalOnLayoutListener(mOnGlobalLayoutListener);
ActionMenuView menuView = getMenuView();
for(int i = 0, count = menuView == null ? 0 : menuView.getChildCount(); i < count; i++){
View child = menuView.getChildAt(i);
if(mRippleStyle != 0){
if(child.getBackground() == null || !(child.getBackground() instanceof ToolbarRippleDrawable))
ViewUtil.setBackground(child, getBackground());
}
}
if(mGroupChanged){
animateIn();
mGroupChanged = false;
}
}
示例2: onPrepareOptionsMenu
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
//fixing toolbar icons after changing theme
//should be fixed in next support release
Toolbar t = (Toolbar) findViewById(R.id.toolbar);
for (int i = 0; i < t.getChildCount(); i++) {
if (t.getChildAt(i) instanceof ActionMenuView) {
ActionMenuView v = (ActionMenuView) t.getChildAt(i);
for (int j = 0; j < v.getChildCount(); j++) {
if (v.getChildAt(j) instanceof TintImageView) {
TintImageView v1 = (TintImageView) v.getChildAt(j);
v1.setImageResource(R.drawable.abc_ic_menu_moreoverflow_mtrl_alpha);
}
}
}
}
return super.onPrepareOptionsMenu(menu);
}
示例3: animateIn
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
private void animateIn(){
ActionMenuView menuView = getMenuView();
for(int i = 0, count = menuView == null ? 0 : menuView.getChildCount(); i < count; i++){
View child = menuView.getChildAt(i);
Animation anim = mAnimator.getInAnimation(child, i);
if(anim != null)
child.startAnimation(anim);
}
}
示例4: setButtonTextColor
import android.support.v7.widget.ActionMenuView; //導入方法依賴的package包/類
private void setButtonTextColor() {
final ActionMenuView buttonsContainer = ViewUtils.findChildByClass(this, ActionMenuView.class);
if (buttonsContainer != null) {
for (int i = 0; i < buttonsContainer.getChildCount(); i++) {
if (buttonsContainer.getChildAt(i) instanceof TextView) {
((TextView) buttonsContainer.getChildAt(i)).setTextColor(getButton(i).getColor().getColor());
}
}
}
}