【问题标题】:Not focus edittext the first time [duplicate]第一次不关注edittext [重复]
【发布时间】:2016-10-06 18:39:49
【问题描述】:

当我在编辑文本中有焦点时显示键盘有问题。我想在我显示我的屏幕后第一次移除焦点。任何专业人士都可以帮助我。太感谢了。

【问题讨论】:

    标签: android android-edittext focus


    【解决方案1】:

    设置父布局的属性

    android:focusable="true"  
    android:focusableInTouchMode="true"
    

    像这样:

    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="@color/black"
        android:gravity="center_horizontal"
    
        android:focusable="true"  
        android:focusableInTouchMode="true">
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/logo"
            android:background="@drawable/dictionary_logo"/>
    
        <RelativeLayout 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/searchbar_bg"
            android:gravity="center_vertical">
    
            <EditText
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:id="@+id/et_search"
               android:background="@null"
               android:hint="Search"
               android:singleLine="true"/>
    
        </RelativeLayout>
    
    </LinearLayout>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-15
      • 1970-01-01
      • 2014-12-13
      • 1970-01-01
      • 2019-08-14
      • 1970-01-01
      • 2011-11-09
      • 1970-01-01
      相关资源
      最近更新 更多