Android:启动屏幕上显示的键盘

Android:启动屏幕上显示的键盘,android,android-softkeyboard,splash-screen,Android,Android Softkeyboard,Splash Screen,我写了一个闪屏。但问题是,屏幕上显示的启动屏幕也调用了键盘。可能的原因是什么 请找到下面的图片 活动的代码gos如下所示 public class SplashActivity extends Activity{ private final int SPLASH_DISPLAY_LENGHT = 2000; @Override protected void onCreate(Bundle savedInstanceState) { // TODO A

我写了一个闪屏。但问题是,屏幕上显示的启动屏幕也调用了键盘。可能的原因是什么

请找到下面的图片

活动的代码gos如下所示

public class SplashActivity extends Activity{

    private final int SPLASH_DISPLAY_LENGHT = 2000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);

        /* New Handler to start the Menu-Activity

         * and close this Splash-Screen after some seconds.*/

        new Handler().postDelayed(new Runnable(){

                @Override

                public void run() {

                        /* Create an Intent that will start the Menu-Activity. */

                        Intent splash2 = new Intent(SplashActivity.this,SplashActivityRed.class);

                        SplashActivity.this.startActivity(splash2);

                        SplashActivity.this.finish();
                        overridePendingTransition(R.anim.fadein,R.anim.fadeout);
                }

        }, SPLASH_DISPLAY_LENGHT);

    }



}
还有xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
    <ImageView android:id="@+id/imageViewSplash" android:layout_height="fill_parent" android:layout_width="fill_parent" android:background="@drawable/splash1" android:src="@drawable/splash1"></ImageView>
</LinearLayout> 


PS:抱歉,我不得不隐藏文字和徽标,因为它们属于我工作的公司的保密政策。

请从布局中删除imageView,并在线性布局元素中添加以下行

 android:background="@drawable/splash1"
像这样:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout   xmlns:android="http://schemas.android.com/apk/res/android" 
 android:layout_width="fill_parent"   
 android:layout_height="fill_parent" 
 android:background:"@drawable/splash1">  
 </LinearLayout>  

希望这有帮助

还可以使用上述布局更改SplashScreen的实现。要更改时间线,请将welcomeScreenDisplay的值更改为任意值。目前为4秒,即4000毫秒

public class SplashScreen extends Activity {
String status, subscriber;
Intent i = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    System.out.println("FIRST");
    setContentView(R.layout.splash);
    System.out.println("in HOME SCREEN");
    /** set time to splash out */
    final int welcomeScreenDisplay = 4000;
    /** create a thread to show splash up to splash time */
    Thread welcomeThread = new Thread() {

    int wait = 0;

    @Override
    public void run() {
    try {
    super.run();
    /**
    * use while to get the splash time. Use sleep() to increase
    * the wait variable for every 100L.
    */
    while (wait < welcomeScreenDisplay) {
    sleep(100);
    wait += 100;
    }
    } catch (Exception e) {
    System.out.println("EXc=" + e);
    } finally {
    /**
    * Called after splash times up. Do some action after splash
    * times up. Here we moved to another main activity class
    */


  finish();
    }
    }



    };
    welcomeThread.start();


}
}
公共类SplashScreen扩展活动{
字符串状态,订户;
意图i=无效;
/**在首次创建活动时调用*/
@凌驾
创建时的公共void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
System.out.println(“第一”);
setContentView(R.layout.splash);
System.out.println(“主屏幕内”);
/**设定泼水的时间*/
最终屏幕显示=4000;
/**创建一个线程以显示从启动到启动时间的启动*/
线程welcomeThread=新线程(){
int wait=0;
@凌驾
公开募捐{
试一试{
super.run();
/**
*使用while获得启动时间。使用sleep()增加启动时间
*每100升的等待变量。
*/
while(等待
您可能需要禁用图像的触摸事件。但是,从布局中删除imageView并将背景图像添加到线性布局元素

 android:background="@drawable/splash1"
android:background=“@drawable/splash1”
使用以下方法:

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_‌​HIDDEN);

你能和我们分享一下这个XML布局文件吗。xml@shah-附件。请在上面找到。顺便说一句,当我在emulator中测试时,键盘没有出现。当我尝试Nexus S时,它就来了。不知道其他手机是否也一样。对不起,看不到问题中的xml文件??它在哪里?在底部。我能看见。你不能:((?)不,这没有帮助。我只是把设备拿到手上。我仍然测试了无原因调用的软键盘。(参见我编辑的答案:)b希望这有帮助??它在我这边工作得很好。在所有设备、模拟器和平板电脑上…getWindow().setSoftInputMode(WindowManager.LayoutParams.soft\u INPUT\u STATE\u ALWAYS\u HIDDEN);这完全帮助了我:)