您可以通過這種方式執行此操作:
價值觀文件夾中創建styles.xml。 xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:weightSum="1">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="@string/hello" />
<ImageView android:layout_width="fill_parent" android:id="@+id/imageView1"
android:src="@drawable/icon" android:layout_weight="0.52"
android:layout_height="wrap_content"></ImageView>
</LinearLayout>
您的任何活動:TestAppActivity
package com.android.test;
import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.ImageView;
public class TestAppActivity extends Activity第一次創建活動時調用。 */ 私人ImageView imgView; 私人處理程序處理程序;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
imgView = (ImageView) findViewById(R.id.imageView1);
handler = new Handler();
Thread t = new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
handler.post(new Runnable() {
@Override
public void run() {
imgView.setVisibility(View.GONE);
}
});
}
});
t.start();
}
}
來吧...這裏是你的工作? – 2012-03-16 04:42:12