以下是GIF:
代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:subtitleTextColor="@color/colorAccent"
app:titleTextColor="@color/colorPrimary"
tools:context="com.sawant.pritish.venetianhonda.MainActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:scaleType="fitXY"
android:src="@drawable/mainimage2" />
<LinearLayout
android:id="@+id/linearoffloatingandtextview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginLeft="@dimen/floatingactionbuttonmargin"
android:layout_marginTop="@dimen/floatingactionbuttonmargin"
android:src="@mipmap/newfloating"
app:backgroundTint="#ff0000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="-18dp"
android:layout_marginTop="15dp"
android:background="@drawable/roundedcorner"
android:text=" MENU "
android:textColor="@android:color/white"
android:textSize="22sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/menulist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/linearoffloatingandtextview"
android:layout_marginLeft="30dp"
android:layout_marginTop="@dimen/floatingactionbuttonmargin"
android:orientation="vertical"
android:visibility="gone"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/salesimageview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/sales" />
<TextView
android:id="@+id/salestextview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10sp"
android:background="@drawable/roundedcornerwhite"
android:text="Sales"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal">
<ImageView
android:id="@+id/serviceimageview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/service" />
<TextView
android:id="@+id/servicetextview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10sp"
android:background="@drawable/roundedcornerwhite"
android:text="Service"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/specialoffers" />
<TextView
android:id="@+id/specialoffers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10sp"
android:background="@drawable/roundedcornerwhite"
android:text="Special Offers"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal">
<ImageView
android:id="@+id/contactusimageview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/contactus" />
<TextView
android:id="@+id/contactustextview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10sp"
android:background="@drawable/roundedcornerwhite"
android:text="Contact Us"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal">
<ImageView
android:id="@+id/aboutusimageview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/aboutus" />
<TextView
android:id="@+id/aboutustextview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10sp"
android:background="@drawable/roundedcornerwhite"
android:text="About Us"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/directionsimageview"
android:src="@mipmap/getdirection" />
<TextView
android:id="@+id/directionstextview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10sp"
android:background="@drawable/roundedcornerwhite"
android:text="Get Direction"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
<include layout="@layout/samebottomlayout"/>
</RelativeLayout>
我创建了销售,服务,关于我们,联系我们,在单独的LinearLayouts中获取方向按钮,这是LinearLayout的父项。点击浮动按钮我能隐藏并显示按钮但是无法计算动画。我需要应用什么样的动画。我需要使用单独的后台线程并在点击浮动按钮时应用动画。请帮助
答案 0 :(得分:0)
cpio.wait()
rpm2cpio.wait()
# Remove the temp directory and all it's contents
shutil.rmtree("/tempdir")
R.layout.test_recyclerview
package com.litedevs.movieconic.activity;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.litedevs.movieconic.R;
/**
* Created by rahul on 01/11/17.
*/
public class TestActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test_recyclerview);
View[] menuItems = new View[]{
findViewById(R.id.container1),
findViewById(R.id.container2),
findViewById(R.id.container3),
findViewById(R.id.container4),
findViewById(R.id.container5),
};
for(View menuItem : menuItems) {
menuItem.setPivotX(0.0f);
menuItem.setPivotY(0.0f);
menuItem.setScaleX(0.0f);
menuItem.setScaleY(0.0f);
menuItem.setAlpha(0.0f);
}
new Handler().postDelayed(getNextAnimator(menuItems, 0), 2000);
}
private Runnable getNextAnimator(final View[] views, final int position) {
if(position >= views.length)
return null;
return new Runnable() {
@Override
public void run() {
views[position]
.animate()
.scaleX(1.0f)
.scaleY(1.0f)
.alpha(1.0f)
.setInterpolator(new FastOutSlowInInterpolator())
.setDuration(200)
.withEndAction(getNextAnimator(views,position+1))
.start();
}
};
}
}