AnimatorSet set = new AnimatorSet();
final int height = holder.deleteConfirmLayout.getMeasuredHeight();
ValueAnimator anim = ValueAnimator.ofInt(0, holder.deleteConfirmLayout.getMeasuredHeight());
anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
int val = (Integer) valueAnimator.getAnimatedValue();
//레이아웃 파람으로 높이 증가하기
// ViewGroup.LayoutParams layoutParams = holder.rootLayout.getLayoutParams();
// layoutParams.height = height + val; //height 는 고정높이 + 변동수치
// holder.rootLayout.setLayoutParams(layoutParams);
//패딩으로 높이 에니메이션 증가 하기
// RelativeLayout.LayoutParams delParams = (RelativeLayout.LayoutParams) (holder.rootLayout.getLayoutParams());
// holder.rootLayout.setPadding(holder.rootLayout.getPaddingLeft(), val, holder.rootLayout.getPaddingRight(), holder.rootLayout.getPaddingBottom());
holder.swipeLayout.setPadding(holder.swipeLayout.getPaddingLeft(), holder.swipeLayout.getPaddingTop(), holder.swipeLayout.getPaddingRight(), val);
// RelativeLayout.LayoutParams delParams = (RelativeLayout.LayoutParams)(holder.deleteConfirmLayout.getLayoutParams());
// delParams.topMargin = val;
// holder.deleteConfirmLayout.setLayoutParams(delParams);
}
});
//ObjectAnimator와 함께 높이와 translationY을 구현 가능(숨겨진상태로 아래로 내려오기)
// ObjectAnimator deleteConfirmAnimator = ObjectAnimator.ofFloat(holder.deleteConfirmLayout, "translationY", 0, holder.deleteConfirmLayout.getMeasuredHeight());
// set.play(deleteConfirmAnimator).with(anim);
// set.start();
anim.start();
*레이아웃
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_comment_list_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/trendit_background_white"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<LinearLayout
android:id="@+id/comment_list_delete_confirm_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/swipe"
android:visibility="visible"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
>
<android.support.v7.widget.AppCompatEditText
android:id="@+id/comment_list_delete_password"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/top_border"
style="@style/TextAppearance.Smartcamping.Comment.Password"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:textColorHint="@color/trendit_grey"
android:textColor="@color/trendit_dark_blue"
android:hint="@string/password"
android:inputType="textPassword"
android:maxLength="6"
/>
<TextView
android:id="@+id/comment_list_delete_error"
android:layout_width="match_parent"
android:layout_height="20dp"
android:paddingLeft="12dp"
android:text="비밀번호가 일치하지 않습니다."
style="@style/TextAppearance.Smartcamping.Comment.ErrorAlert"
/>
</LinearLayout>
<Button
android:id="@+id/comment_list_delete_confirm"
android:layout_width="52dp"
android:layout_height="40dp"
style="@style/TextAppearance.Smartcamping.DeleteComfirm"
android:gravity="center"
android:text="@string/comfirm"
/>
</LinearLayout>
<com.daimajia.swipe.SwipeLayout
xmlns:swipe="http://schemas.android.com/apk/res-auto"
android:id="@+id/swipe"
android:layout_width="match_parent"
android:layout_height="wrap_content"
swipe:leftEdgeSwipeOffset="0dp"
swipe:rightEdgeSwipeOffset="0dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
>
<Button
android:id="@+id/tv_delete_comment"
style="@style/TextAppearance.Smartcamping.Delete"
android:layout_width="52dp"
android:layout_height="match_parent"
android:background="@color/trendit_light_grey"
android:text="@string/delete"
android:layout_gravity="right"
android:gravity="center"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_comment_list_row_body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:background="@color/trendit_background_white"
android:baselineAligned="false"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/fl_comment_list_row_profile"
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_weight="0"
android:visibility="gone">
<ImageView
android:id="@+id/iv_comment_list_row_profile"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/me_photoframe4" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_comment_list_row_nicname"
style="@style/TextAppearance.Smartcamping.comment.nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tv_comment_list_row_date"
style="@style/TextAppearance.Smartcamping.Comment.Date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10.6dp" />
</LinearLayout>
<TextView
android:id="@+id/tv_comment_list_row_msg"
style="@style/TextAppearance.Smartcamping.Comment.Msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
<ImageView
android:id="@+id/iv_comment_list_row_attached"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
</LinearLayout>
</LinearLayout>
<!--<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/ll_comment_list_row_body"
android:background="@color/trendit_light_grey" />-->
</com.daimajia.swipe.SwipeLayout>
</RelativeLayout>
'안드로이드 > 고급' 카테고리의 다른 글
안드로이드 ImageView scaleType 정리 자료 (0) | 2017.10.04 |
---|---|
안드로이드 타이머 구현 자료 (0) | 2017.10.04 |
안드로이드 크롭 구현 자료 (0) | 2017.10.04 |
안드로이드 갤러리 구현 자료 (0) | 2017.10.04 |
안드로이드 자식뷰 강제 높이 구하기 (0) | 2017.10.04 |