取消自动获取焦点(默认进来焦点到edittext),取消进入呼出软件盘

复制代码
  <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content"
                  android:id="@+id/checkinlinear" android:layout_below="@id/assetnameet"
                  android:focusable="true"  android:focusableInTouchMode="true"
                  android:lineSpacingExtra="5dip">
        
        <EditText android:id="@+id/checkin_content" android:layout_height="50dip" android:layout_width="200dip"
                  android:layout_weight="1" android:hint="@string/checkin_content_hint" android:singleLine="true"/>
      
        <Button android:text="@string/checkin_submit_btn" android:id="@+id/checkin_submitbtn"
                android:layout_height="wrap_content" android:layout_width="wrap_content"
                android:layout_weight="3"/>
    </LinearLayout>
复制代码

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

此前,当我进入做项目的时候!发现,当我进入到对应的ui中,焦点会自动的到edittext中,这样就会呼出软键盘!我在网上找了一些资料!有的是关闭,或者监控软键盘状态,或者焦点位置!

   但是!这些都不是我项目想要的!

  我想要的仅仅是第一次进入到对应ui的时候,不要呼出软键盘,当用户点击的时候,才呼出软键盘!

 

设置这个Activity中的一点点属性

 <activity
            android:name=".activity.VasDetailActivity"
            android:theme="@android:style/Theme.NoTitleBar"
            android:windowSoftInputMode="adjustUnspecified|stateHidden" 
            android:configChanges="orientation|keyboardHidden"
            android:label="@string/app_name" >

 而在linearyout中加入这两行代码就能实现我的要求了了!

本文转载自http://shendixiong.iteye.com/blog/1158561 ,已测试实现自己的要求

posted @   似水流云  阅读(209)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端
点击右上角即可分享
微信分享提示