ImageView我的布局中只有一个,当检测到gasture事件时,我正在更改其资源.我只想在更改ImageView的资源时显示动画.我可以使用ViewFlipper与oneImageView的?
我设法在10秒后使imageView消失(我的mainActivity上的教程图像).但我希望能够顺利淡出,因为这样看起来并不好看,任何人都可以向我推荐任何好的教程
img=(ImageView)findViewById(R.id.ImageTutorial);
if(getIntent()!=null)
{
Bundle extras = getIntent().getExtras();
String TutorialDemo=extras !=null? extras.getString("TutorialDemo"):"false";
if(TutorialDemo.equals("true"))
{
Runnable mRunnable;
Handler mHandler=new Handler();
mRunnable=new Runnable() {
@Override
public void run() {
img.setVisibility(View.GONE); //This will remove the View. and free s the space occupied by the View
}
};
mHandler.postDelayed(mRunnable,10*900);
}
else
{
img.setVisibility(View.GONE);
}
}
Run Code Online (Sandbox Code Playgroud)
这是图像视图xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fullview"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical" >
.
.
.
.
<ImageView
android:contentDescription="tutorial"
android:id="@+id/ImageTutorial"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_alignParentBottom="true"
android:background="@drawable/tutorial"
android:layout_marginTop="40dp" …Run Code Online (Sandbox Code Playgroud) 我有Activity一个按钮.如果用户点击Button,我启动服务并完成此操作Activity.我希望淡出它.怎么做?我试过一些方法,但似乎没有用.