Android仿scaleType佈局動畫效果
阿新 • • 發佈:2020-10-26
先看效果圖
1603675346871.gif
效果圖錄製出來有黑屏幀,勉強看哈,效果就是點選輸入框後,頂部縮小,按返回按鈕時再還原
佈局檔案
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="true"
android:fitsSystemWindows="true"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/topPanel"
android:layout_width="match_parent"
android:layout_height="200dp">
<View
android:id="@+id/back_line"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:background="#d4ab7f" />
<ImageView
android:id="@+id/back_bg"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_centerInParent="true"
android:scaleType="centerCrop"
android:src="@mipmap/login_top_back" />
<ImageView
android:id="@+id/logo_bg"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_centerInParent="true"
android:src="@mipmap/default_headimg" />
</RelativeLayout>
<LinearLayout
android:id="@+id/body"
android:layout_width="match_parent"
android:layout_height="210dp"
android:layout_below="@+id/logo"
android:layout_marginTop="30dp"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="13dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/et_mobile"
android:layout_width="0dp"
android:layout_height="55dp"
android:layout_weight="1"
android:background="@null"
android:hint="請輸入手機號碼"
android:inputType="textVisiblePassword"
android:maxLength="11"
android:singleLine="true"
android:text=""
android:textColor="#999999"
android:textColorHint="#999999"
android:textSize="14dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#eeeeee" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity=