jay*_*hkv 0 android splash-screen android-imageview
大家好我有这个启动画面的布局main.xml,其中包含一个imageview,这里是main.xml文件
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/slide11" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的splashscreen.class文件
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try {
new Handler().postDelayed(new Runnable() {
public void run()
Intent intent = new Intent(getApplicationContext(),content_activity.class);
startActivity(intent);
Main.this.finish(); } }, 5000);
} catch(Exception e){}
}
@Override
public void onBackPressed() {
super.onBackPressed();
} }
Run Code Online (Sandbox Code Playgroud)
当我尝试在我的模拟器中运行这一切都工作正常,但当我尝试通过调试模式在设备中运行它我没有得到imageView中指定的图像,但我得到一个指定时间的白色屏幕.任何帮助将非常感激.
//编辑:我仔细检查了res/drawable文件夹,我主要尝试使用png,并且还使用.gif在设备中没有工作.(设备micromax a110)
使用它而不是你的布局.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/slide11" >
Run Code Online (Sandbox Code Playgroud)