本文整理汇总了Java中android.animation.LayoutTransition类的典型用法代码示例。如果您正苦于以下问题:Java LayoutTransition类的具体用法?Java LayoutTransition怎么用?Java LayoutTransition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LayoutTransition类属于android.animation包,在下文中一共展示了LayoutTransition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.animation.LayoutTransition; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_layout_animations);
LayoutTransition layoutTransition = new LayoutTransition();
ObjectAnimator appearingAnim = ObjectAnimator.ofFloat(null, "rotationY", 0f, 90f, 180f, 270f, 359.9999f);
appearingAnim.addListener(new AnimatorListenerAdapter() {
public void onAnimationEnd(Animator anim) {
View view = (View) ((ObjectAnimator) anim).getTarget();
view.setRotationY(0f);
}
});
layoutTransition.setAnimator(LayoutTransition.APPEARING, appearingAnim);
layoutTransition.setDuration(LayoutTransition.APPEARING, 2000L);
layoutTransition.setStartDelay(LayoutTransition.APPEARING, 0);
gridContainer.setLayoutTransition(layoutTransition);
}
示例2: onCreateView
import android.animation.LayoutTransition; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_reading_lists, container, false);
unbinder = ButterKnife.bind(this, view);
searchEmptyView.setEmptyText(R.string.search_reading_lists_no_results);
readingListView.setLayoutManager(new LinearLayoutManager(getContext()));
readingListView.setAdapter(adapter);
readingListView.addItemDecoration(new DrawableItemDecoration(getContext(), R.attr.list_separator_drawable));
WikipediaApp.getInstance().getBus().register(eventBusMethods);
contentContainer.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
emptyContainer.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
((ViewGroup)emptyContainer.getChildAt(0)).getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
swipeRefreshLayout.setColorSchemeResources(getThemedAttributeId(getContext(), R.attr.colorAccent));
swipeRefreshLayout.setOnRefreshListener(ReadingListSyncAdapter::manualSyncWithRefresh);
// TODO: remove when ready.
if (!ReleaseUtil.isPreBetaRelease()) {
swipeRefreshLayout.setEnabled(false);
}
return view;
}
示例3: ZenModeConditionSelection
import android.animation.LayoutTransition; //导入依赖的package包/类
public ZenModeConditionSelection(Context context, int zenMode) {
super(context);
mContext = context;
mZenMode = zenMode;
mConditions = new ArrayList<Condition>();
setLayoutTransition(new LayoutTransition());
final int p = mContext.getResources().getDimensionPixelSize(R.dimen.content_margin_left);
setPadding(p, p, p, 0);
mNoMan = INotificationManager.Stub.asInterface(
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
final RadioButton b = newRadioButton(null);
b.setText(mContext.getString(com.android.internal.R.string.zen_mode_forever));
b.setChecked(true);
for (int i = ZenModeConfig.MINUTE_BUCKETS.length - 1; i >= 0; --i) {
handleCondition(ZenModeConfig.toTimeCondition(mContext,
ZenModeConfig.MINUTE_BUCKETS[i], UserHandle.myUserId()));
}
}
示例4: initView
import android.animation.LayoutTransition; //导入依赖的package包/类
private void initView(Context context) {
if (mIndicatorType == 0) {
for (int i = 0; i < mPinLength; i++) {
View dot = new View(context);
emptyDot(dot);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(mDotDiameter,
mDotDiameter);
params.setMargins(mDotSpacing, 0, mDotSpacing, 0);
dot.setLayoutParams(params);
addView(dot);
}
} else if (mIndicatorType == 2) {
LayoutTransition layoutTransition = new LayoutTransition();
layoutTransition.setDuration(DEFAULT_ANIMATION_DURATION);
layoutTransition.setStartDelay(layoutTransition.APPEARING, 0);
setLayoutTransition(layoutTransition);
}
}
示例5: setGiftLayout
import android.animation.LayoutTransition; //导入依赖的package包/类
/**
* @param giftLayoutParent 存放礼物控件的父容器
* @param giftLayoutNums 礼物控件的数量
* @return
*/
public GiftControl setGiftLayout(LinearLayout giftLayoutParent, @NonNull int giftLayoutNums) {
if (giftLayoutNums <= 0) {
throw new IllegalArgumentException("GiftFrameLayout数量必须大于0");
}
if (giftLayoutParent.getChildCount() > 0) {//如果父容器没有子孩子,就进行添加
return this;
}
mGiftLayoutParent = giftLayoutParent;
mGiftLayoutMaxNums = giftLayoutNums;
LayoutTransition transition = new LayoutTransition();
transition.setAnimator(LayoutTransition.CHANGE_APPEARING,
transition.getAnimator(LayoutTransition.CHANGE_APPEARING));
transition.setAnimator(LayoutTransition.APPEARING,
transition.getAnimator(LayoutTransition.APPEARING));
transition.setAnimator(LayoutTransition.DISAPPEARING,
transition.getAnimator(LayoutTransition.CHANGE_APPEARING));
transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
transition.getAnimator(LayoutTransition.DISAPPEARING));
mGiftLayoutParent.setLayoutTransition(transition);
return this;
}
示例6: register
import android.animation.LayoutTransition; //导入依赖的package包/类
@Override
public void register() {
super.register();
notificationLayout = (LinearLayout) getIconView();
notificationLayout.setPadding(getIconPadding(), 0, getIconPadding(), 0);
notificationLayout.removeAllViewsInLayout();
notifications.clear();
Boolean isIconAnimations = PreferenceUtils.getBooleanPreference(getContext(), PreferenceUtils.PreferenceIdentifier.STATUS_ICON_ANIMATIONS);
isIconAnimations = isIconAnimations != null ? isIconAnimations : true;
notificationLayout.setLayoutTransition(isIconAnimations ? new LayoutTransition() : null);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
Intent intent = new Intent(NotificationService.ACTION_GET_NOTIFICATIONS);
intent.setClass(getContext(), NotificationService.class);
getContext().startService(intent);
}
}
示例7: CreateFloatLayout
import android.animation.LayoutTransition; //导入依赖的package包/类
public static WindowManager.LayoutParams CreateFloatLayout(WindowManager wm, WebView fwv, View tview, FloatLinearLayout layout, float px, float py, boolean show, int width, int height) {
WindowManager.LayoutParams wmParams = ParamsSet(px, py, fwv, width, height);
layout.setLayoutTransition(new LayoutTransition());
layout.setBackgroundColor(Color.parseColor("#303F9F"));
layout.setOrientation(FloatLinearLayout.VERTICAL);
layout.setPadding(0, 50, 0, 0);
layout.setLayout_default_flags(wmParams.flags);
layout.setTop(true);
layout.setAddPosition(px, py);
layout.setFloatLayoutParams(wmParams);
layout.setAllowlongclick(false);
layout.changeShowState(show);
layout.addView(tview);
layout.addView(fwv);
if (show) {
wm.addView(layout, wmParams);
fwv.reload();
}
return wmParams;
}
示例8: setupTransition
import android.animation.LayoutTransition; //导入依赖的package包/类
private void setupTransition(LayoutTransition transition) {
CheckBox customAnimCB = (CheckBox) findViewById(R.id.customAnimCB);
CheckBox appearingCB = (CheckBox) findViewById(R.id.appearingCB);
CheckBox disappearingCB = (CheckBox) findViewById(R.id.disappearingCB);
CheckBox changingAppearingCB = (CheckBox) findViewById(R.id.changingAppearingCB);
CheckBox changingDisappearingCB = (CheckBox) findViewById(R.id.changingDisappearingCB);
transition.setAnimator(LayoutTransition.APPEARING, appearingCB.isChecked() ?
(customAnimCB.isChecked() ? customAppearingAnim : defaultAppearingAnim) : null);
transition.setAnimator(LayoutTransition.DISAPPEARING, disappearingCB.isChecked() ?
(customAnimCB.isChecked() ? customDisappearingAnim : defaultDisappearingAnim) : null);
transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changingAppearingCB.isChecked() ?
(customAnimCB.isChecked() ? customChangingAppearingAnim :
defaultChangingAppearingAnim) : null);
transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
changingDisappearingCB.isChecked() ?
(customAnimCB.isChecked() ? customChangingDisappearingAnim :
defaultChangingDisappearingAnim) : null);
}
示例9: prepareLayoutWithoutChildren
import android.animation.LayoutTransition; //导入依赖的package包/类
/***
* This function is used to prepare the layout after the initialize funciton but is called when the developer PROGRAMATICALLY adds
* the accordion from the class. Hence, the accordion does not have the UI elements (children) yet
* @param context
*/
private void prepareLayoutWithoutChildren(Context context) {
initializeViewWithoutChildren(context);
partition.setVisibility(isPartitioned ? VISIBLE : INVISIBLE);
heading.setText(headingString);
paragraph.setVisibility(VISIBLE);
//paragraph.getViewTreeObserver().addOnGlobalLayoutListener(globalLayoutListener);
if (isAnimated) {
headingLayout.setLayoutTransition(new LayoutTransition());
} else {
headingLayout.setLayoutTransition(null);
}
if (isExpanded)
expand();
else
collapse();
setOnClickListenerOnHeading();
}
示例10: initView
import android.animation.LayoutTransition; //导入依赖的package包/类
private void initView(Context context) {
ViewCompat.setLayoutDirection(this, ViewCompat.LAYOUT_DIRECTION_LTR);
if (mIndicatorType == 0) {
for (int i = 0; i < mPinLength; i++) {
View dot = new View(context);
emptyDot(dot);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(mDotDiameter,
mDotDiameter);
params.setMargins(mDotSpacing, 0, mDotSpacing, 0);
dot.setLayoutParams(params);
addView(dot);
}
} else if (mIndicatorType == 2) {
setLayoutTransition(new LayoutTransition());
}
}
示例11: setHeaderVisible
import android.animation.LayoutTransition; //导入依赖的package包/类
/**
* Sets the {@link TableView} header visible or hides it.
*
* @param visible Whether the {@link TableView} header shall be visible or not.
*/
public void setHeaderVisible(boolean visible, int animationDuration) {
if (visible && !isHeaderVisible()) {
if (animationDuration > 0) {
final Animator moveInAnimator = ObjectAnimator.ofPropertyValuesHolder((Object) null, PropertyValuesHolder.ofFloat("y", 0));
moveInAnimator.setDuration(animationDuration);
layoutTransition.setAnimator(LayoutTransition.APPEARING, moveInAnimator);
setLayoutTransition(layoutTransition);
} else {
setLayoutTransition(null);
}
addView(tableHeaderView, 0);
} else if (!visible && isHeaderVisible()) {
if (animationDuration > 0) {
final Animator moveOutAnimator = ObjectAnimator.ofPropertyValuesHolder((Object) null, PropertyValuesHolder.ofFloat("y", -tableHeaderView.getHeight()));
moveOutAnimator.setDuration(animationDuration);
layoutTransition.setAnimator(LayoutTransition.DISAPPEARING, moveOutAnimator);
setLayoutTransition(layoutTransition);
} else {
setLayoutTransition(null);
}
removeView(tableHeaderView);
}
}
示例12: enableLayoutTransitions
import android.animation.LayoutTransition; //导入依赖的package包/类
private void enableLayoutTransitions() {
LayoutTransition transition = getLayoutTransition();
transition.enableTransitionType(LayoutTransition.APPEARING);
transition.enableTransitionType(LayoutTransition.DISAPPEARING);
transition.enableTransitionType(LayoutTransition.CHANGE_APPEARING);
transition.enableTransitionType(LayoutTransition.CHANGE_DISAPPEARING);
}
示例13: setupLayoutTransition
import android.animation.LayoutTransition; //导入依赖的package包/类
private void setupLayoutTransition() {
// We want to show layout transitions when pages are deleted, to close the gap.
mLayoutTransition = new LayoutTransition();
mLayoutTransition.enableTransitionType(LayoutTransition.DISAPPEARING);
mLayoutTransition.enableTransitionType(LayoutTransition.CHANGE_DISAPPEARING);
mLayoutTransition.disableTransitionType(LayoutTransition.APPEARING);
mLayoutTransition.disableTransitionType(LayoutTransition.CHANGE_APPEARING);
setLayoutTransition(mLayoutTransition);
}
示例14: init
import android.animation.LayoutTransition; //导入依赖的package包/类
private void init(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
mFirstModeChange = true;
mContext = context;
if (attrs != null) {
TypedArray types = mContext.obtainStyledAttributes(attrs,
R.styleable.OForm);
mModel = types.getString(R.styleable.OForm_modelName);
mEditable = types.getBoolean(R.styleable.OForm_editableMode,
false);
autoUIGenerate = types.getBoolean(R.styleable.OForm_autoUIGenerate, true);
icon_tint_color = types.getColor(R.styleable.OForm_controlIconTint, -1);
types.recycle();
}
initForm();
LayoutTransition transition = new LayoutTransition();
setLayoutTransition(transition);
}
示例15: init
import android.animation.LayoutTransition; //导入依赖的package包/类
private void init() {
setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mPresenter.toggleIsExtended();
}
});
//TODO-beauty: Fix AbilityCard animation so that the image on the card doesn't just jump
// but animates smoothly like the rest of the card
LayoutTransition transition = new LayoutTransition();
transition.enableTransitionType(LayoutTransition.CHANGING);
transition.setDuration(300);
setLayoutTransition(transition);
inflate(getContext(), R.layout.item_ability_info, this);
}