如何隐藏车展上的布局走了键盘 [英] How to hide auto show keyboard on layout gone

查看:154
本文介绍了如何隐藏车展上的布局走了键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@android:color/background_dark"
    android:weightSum="1" >

    <LinearLayout
        android:id="@+id/layout_splash"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="0.3" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:src="@drawable/logo" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_marginTop="20dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.5"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/testoCaricamento"
            android:layout_gravity="center"
            android:textSize="20dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="TextView" />

        <LinearLayout
            android:id="@+id/layoutNomeTablet"
            android:visibility="gone"
            android:layout_width="match_parent"
            android:layout_marginTop="40dp"
            android:layout_height="wrap_content"
            android:weightSum="1" >

            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:textSize="20dp"
                android:layout_marginRight="15dp"
                android:layout_weight="0.2"
                android:text="Nome tablet" />

            <EditText
                android:id="@+id/editText1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="0.5" >

                <requestFocus />
            </EditText>

            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="30dp"
                android:layout_weight="0.1"
                android:text="Salva" />

        </LinearLayout>

    </LinearLayout>

</LinearLayout>

在显示我的启动画面,会出现键盘即使包含的EditText 的知名度去布局。我怎么可以显示键盘,只有当EditText上是可见的,重点突出?

When my splashscreen is shown, keyboard appears even if the layout that contain the EditText has visibility gone. how can i show keyboard only when edittext is visible and focused?

推荐答案

试着做你的EditText这种变化。

Try making this change in your EditText.

<EditText
            android:id="@+id/editText1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight=""
</EditText>

这篇关于如何隐藏车展上的布局走了键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆