几张图片以3D立体旋转的效果进行切换(此例由此处参考而来:
public class MainActivity extends Activity
{
private LinearLayout layout; //根布局;
private ImageView picture, picture1; //用于展示图片详细的ImageView;
int[] imgs = {R.drawable.bird, R.drawable.winter, R.drawable.great_wall, R.drawable.water_fall}; //创建一个数组,存放要切换的图片;
Boolean flag = true;
int index = -1; //要加载的图片脚标;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
layout = (LinearLayout) findViewById(R.id.layout);
picture = (ImageView) findViewById(R.id.picture);
picture1 = (ImageView) findViewById(R.id.picture1);
picture.setVisibility(View.GONE);
new Thread()
{
@Override
public void run()
{
while(flag)
{
if(index < imgs.length-1)
{
index++;
handler.sendEmptyMessage(0);
}
else if(index >= imgs.length-1)
{
flag = false;
}
try
{
Thread.sleep(3500);
} catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
}.start();
}
Handler handler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
super.handleMessage(msg);
if(msg.what == 0)