标题:android 开发 启动界面出现问题 图片加载不了
只看楼主
墨然87
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-5-26
 问题点数:0 回复次数:0 
android 开发 启动界面出现问题 图片加载不了
//mainactivity.java

package com.example.b526;

import android.os.Bundle;
import android.app.Activity;
import android.os.Handler;
import android.os.Message;
import android.widget.ViewFlipper;

public class MainActivity extends Activity {
   
    public class SplashScreen extends Activity {
        private ViewFlipper allFlipper;
        private Handler handler = new Handler(){
            @Override
            public void handleMessage(Message msg) {
                // TODO Auto-generated method stub
                switch (msg.what) {
                case 1:
                    //切换到主页面
                    allFlipper.setDisplayedChild(1);
                    break;
                }
            }
        };
        
 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splashscreen);
        allFlipper = (ViewFlipper) findViewById(R.id.relativeLayout1);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                handler.sendEmptyMessage(1); //给UI主线程发送消息
            }
        }, 3000); //启动等待3秒钟
    }
        
    }


}
//splashscreen.xml
<?xml version="1.0" encoding="utf-8"?>
<ViewFlipper xmlns:android="http://schemas.
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <RelativeLayout
        android:id="@+id/splashlayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

       </RelativeLayout>

        <RelativeLayout
            android:id="@+id/relativeLayout1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="206dp" >
        
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/hello_world" />

    </RelativeLayout>

</ViewFlipper>
搜索更多相关主题的帖子: android private public import 图片 
2014-05-26 17:08



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-432088-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.629584 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved