Java Code Examples for android.widget.LinearLayout#setTranslationY()

The following examples show how to use android.widget.LinearLayout#setTranslationY() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DetailActivity.java    From EasyTransition with Apache License 2.0 6 votes vote down vote up
private void initOtherViews() {
    layoutAbout = (LinearLayout) findViewById(R.id.layout_about);
    layoutAbout.setVisibility(View.VISIBLE);
    layoutAbout.setAlpha(0);
    layoutAbout.setTranslationY(-30);
    layoutAbout.animate()
            .setDuration(300)
            .alpha(1)
            .translationY(0);

    ivAdd = (ImageView) findViewById(R.id.iv_add);
    ivAdd.setVisibility(View.VISIBLE);
    ivAdd.setScaleX(0);
    ivAdd.setScaleY(0);
    ivAdd.animate()
            .setDuration(200)
            .scaleX(1)
            .scaleY(1);
}
 
Example 2
Source File: PushBehavior.java    From RecyclerViewSyncDemo with MIT License 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public boolean onDependentViewChanged(@NonNull final CoordinatorLayout parent, @NonNull final LinearLayout child, @NonNull final View dependency) {
    final Boolean apiCompatible = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
    if (apiCompatible) {
        final Float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight());
        child.setTranslationY(translationY);
    }
    return apiCompatible;
}
 
Example 3
Source File: ProfileProgressbar.java    From ViewInspector with Apache License 2.0 5 votes vote down vote up
@Override protected void onAttachedToWindow() {
  super.onAttachedToWindow();
  LinearLayout progressbarLayout = (LinearLayout) findViewById(R.id.progressbar_layout);
  progressbarLayout.setTranslationY(-mLayoutHeight);
  progressbarLayout.setVisibility(VISIBLE);
  ObjectAnimator animator =
      ObjectAnimator.ofFloat(progressbarLayout, "translationY", -mLayoutHeight, 0);
  animator.setInterpolator(new DecelerateInterpolator());
  animator.setDuration(500);
  animator.start();
}
 
Example 4
Source File: NotificationLayout.java    From NotificationPeekPort with Apache License 2.0 5 votes vote down vote up
private void showNotificationContent() {
    if (mContentShowing) {
        // Content is already showing.
        return;
    }
    mContentShowing = true;
    StatusBarNotification selectedNotification =
            (StatusBarNotification) mNotificationPeek.getNotificationView().getTag();

    View contentView = PeekLayoutFactory
            .createPeekLayout(getContext(), PeekLayoutFactory.LAYOUT_TYPE_CONTENT,
                    selectedNotification);
    contentView.setId(R.id.notification_content);
    RelativeLayout.LayoutParams params =
            new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT);
    params.addRule(RelativeLayout.ABOVE, R.id.notification_layout);
    contentView.setLayoutParams(params);

    // Animations.
    LinearLayout contentTextLayout =
            (LinearLayout) contentView.findViewById(R.id.content_layout);
    contentTextLayout.setTranslationY(50);
    contentView.setAlpha(0);
    ((ViewGroup)getParent()).addView(contentView);

    contentView.animate().alpha(1f).setInterpolator(new DecelerateInterpolator()).start();
    contentTextLayout.animate().translationY(0).setInterpolator(new DecelerateInterpolator())
            .start();

    // Send broadcast to NotificationPeekActivity and let it hide the other components
    // when the content is displayed.
    Intent intent =
            new Intent(NotificationPeekActivity.NotificationPeekReceiver.ACTION_SHOW_CONTENT);
    getContext().sendBroadcast(intent);
}
 
Example 5
Source File: MoveUpBehaviour.java    From youqu_master with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, LinearLayout child, View dependency) {
    float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight());
    child.setTranslationY(translationY);
    return true;
}
 
Example 6
Source File: MoveUpBehaviour.java    From AsteroidOSSync with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, LinearLayout child, View dependency) {
    float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight());
    child.setTranslationY(translationY);
    return true;
}
 
Example 7
Source File: MoveUpBehaviour.java    From material-intro-screen with MIT License 4 votes vote down vote up
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, LinearLayout child, View dependency) {
    float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight());
    child.setTranslationY(translationY);
    return true;
}
 
Example 8
Source File: TopActivity.java    From AndroidLinkup with GNU General Public License v2.0 4 votes vote down vote up
private void hideSearchPad() {
    LinearLayout rltSearch = (LinearLayout) findViewById(R.id.lltSearch);
    rltSearch.setTranslationY(size.y);
}