В Android я пытаюсь fadein и fadeout 2 изображения при щелчке по image.Ex: Если я нажимаю image1, он исчезает (исчезает), а изображение2 исчезает (я вижу), и когда i щелкните изображение 2, оно исчезает и показывает мне изображение1 (исчезает). Но проблема здесь в том, что подкладка не происходит так, как ожидалось.Android fade In и исчезают 2 изображения
package com.example.sandeep.myapplication;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
public class MainActivity extends Activity {
public void fade(View view){
ImageView img1=(ImageView) findViewById(R.id.img1);
ImageView img2=(ImageView) findViewById(R.id.img2);
img1.animate().alpha(0f).setDuration(2000);
img2.animate().alpha(1f).setDuration(2000);
Log.i("Info:","fade method running");
}
public void fade1(View view) {
ImageView img1 = (ImageView) findViewById(R.id.img1);
ImageView img2 = (ImageView) findViewById(R.id.img2);
img2.animate().alpha(0f).setDuration(2000);
img1.animate().alpha(1f).setDuration(2000);
Log.i("Info:","fade1 method running");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Так что, когда я нажимаю на изображении только fade1() метод пробеги, и я должен нажать несколько раз на dirrenent screenlocations сделать метод fade2() run.In моей консоли я получаю ниже упомянутые журналы,
02-07 02:29:44.088 10720-10720/com.example.sandeep.myapplication I/Info::
fade1 method running
02-07 02:29:49.728 10720-10720/com.example.sandeep.myapplication I/Info::
fade1 method running
[ 02-07 02:29:50.005 8757: 8757 E/ ]
[adb] handle_packet() t->online(1) p->msg.arg0(23439) p->msg.arg1(0) OPEN
[ 02-07 02:29:50.005 8757: 8757 E/ ]
[adb] handle the adb command, and the command = adb shell:cat
/proc/net/xt_qtaguid/stats | grep 10181
[ 02-07 02:29:50.032 8757: 8757 E/ ]
[adb] cuurent command is A_CLSE
Помогите решить эту проблему.