本文整理汇总了Java中android.widget.FrameLayout.setAddStatesFromChildren方法的典型用法代码示例。如果您正苦于以下问题:Java FrameLayout.setAddStatesFromChildren方法的具体用法?Java FrameLayout.setAddStatesFromChildren怎么用?Java FrameLayout.setAddStatesFromChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.FrameLayout
的用法示例。
在下文中一共展示了FrameLayout.setAddStatesFromChildren方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LabelLayout
import android.widget.FrameLayout; //导入方法依赖的package包/类
public LabelLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setWillNotDraw(false);
setAddStatesFromChildren(true);
mInputFrame = new FrameLayout(context);
mInputFrame.setAddStatesFromChildren(true);
super.addView(mInputFrame, -1, generateDefaultLayoutParams());
mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
mTextPaint.setTypeface(Typeface.DEFAULT);// getTypeface());
mTextSizeCollapsed = getResources().getDimensionPixelSize(R.dimen.abc_text_size_caption_material);
mTextSizeExpanded = getResources().getDimensionPixelSize(R.dimen.abc_text_size_medium_material);
mTextPaint.setTextSize(mTextSizeCollapsed);
StyledAttributesHelper ta = StyledAttributesHelper.obtainStyledAttributes(context, attrs,
new int[] { R.attr.doNotExpand, android.R.attr.hint, android.R.attr.textColorHint });
try {
mDoNotExpand = ta.getBoolean(R.attr.doNotExpand, false);
mHint = ta.getString(android.R.attr.hint);
mTextColorUnfocused = ta.getColorStateList(android.R.attr.textColorHint);
} finally {
ta.recycle();
}
mTextColorFocused = ThemeHelper.getAccentColor(context);
mTextPaint.setColor(mTextColorUnfocused.getColorForState(getDrawableState(), mTextColorUnfocused.getDefaultColor()));
mAnimator = ValueAnimator.ofFloat(0.f, 1.f);
mAnimator.setInterpolator(new LinearInterpolator());
mAnimator.setDuration(200);
mAnimator.addUpdateListener((ValueAnimator animation) -> {
mAnimState = (float) animation.getAnimatedValue();
invalidate();
});
updateTopMargin();
updateTextPositions();
}