在EditText控件前面的任意一个控件,比如 TextView 控件,设置两个属性 Focusable = true ,FocusableInTouchMode=true 代表这个控件取得焦点,那么默认输入法就不会跳出来了,如下所示:
1 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 android:id="@+id/ScrollView1" 4 android:layout_width="match_parent" 5 android:layout_height="match_parent" 6 android:background="@color/blank" > 7 8 <LinearLayout 9 android:layout_width="match_parent" 10 android:layout_height="match_parent" 11 android:orientation="vertical" > 12 13 <LinearLayout 14 android:layout_width="match_parent" 15 android:layout_height="wrap_content" > 16 17 18 19 20 21 <TextView 22 android:id="@+id/textView1" 23 android:layout_width="wrap_content" 24 android:layout_height="wrap_content" 25 android:focusable="true" 26 android:focusableInTouchMode="true" 27 android:text="客户编号:" 28 android:textColor="@color/white" /> 29 30 <EditText 31 android:id="@+id/editText1" 32 android:layout_width="wrap_content" 33 android:layout_height="wrap_content" 34 android:layout_weight="1" 35 android:ems="10" > 36 </EditText> 37 38 </LinearLayout> 39 40 <LinearLayout 41 android:layout_width="match_parent" 42 android:layout_height="wrap_content" > 43 44 45 46 <TextView 47 android:id="@+id/textView2" 48 android:layout_width="wrap_content" 49 android:layout_height="wrap_content" 50 android:text="客户名称:" 51 android:textColor="@color/white" /> 52 53 <EditText 54 android:id="@+id/editText2" 55 android:layout_width="wrap_content" 56 android:layout_height="wrap_content" 57 android:layout_weight="1" 58 android:ems="10" /> 59 60 </LinearLayout> 61 62 <LinearLayout 63 android:layout_width="match_parent" 64 android:layout_height="wrap_content" > 65 66 67 <TextView 68 android:id="@+id/textView3" 69 android:layout_width="wrap_content" 70 android:layout_height="wrap_content" 71 android:text="负 责 人:" 72 android:textColor="@color/white" /> 73 74 <EditText 75 android:id="@+id/editText3" 76 android:layout_width="wrap_content" 77 android:layout_height="wrap_content" 78 android:layout_weight="1" 79 android:ems="10" /> 80 81 </LinearLayout> 82 83 <LinearLayout 84 android:layout_width="match_parent" 85 android:layout_height="wrap_content" > 86 87 88 <TextView 89 android:id="@+id/textView4" 90 android:layout_width="wrap_content" 91 android:layout_height="wrap_content" 92 android:text="客户地址:" 93 android:textColor="@color/white" /> 94 95 <EditText 96 android:id="@+id/editText4" 97 android:layout_width="wrap_content" 98 android:layout_height="wrap_content" 99 android:layout_weight="1" 100 android:ems="10" /> 101 102 </LinearLayout> 103 104 <LinearLayout 105 android:layout_width="match_parent" 106 android:layout_height="wrap_content" > 107 108 109 110 <TextView 111 android:id="@+id/textView5" 112 android:layout_width="wrap_content" 113 android:layout_height="wrap_content" 114 android:text="公司网站:" 115 android:textColor="@color/white" /> 116 117 <EditText 118 android:id="@+id/editText5" 119 android:layout_width="wrap_content" 120 android:layout_height="wrap_content" 121 android:layout_weight="1" 122 android:ems="10" /> 123 124 </LinearLayout> 125 126 <LinearLayout 127 android:layout_width="match_parent" 128 android:layout_height="wrap_content" > 129 130 131 132 <TextView 133 android:id="@+id/textView6" 134 android:layout_width="wrap_content" 135 android:layout_height="wrap_content" 136 android:text="邮政编码:" 137 android:textColor="@color/white" /> 138 139 <EditText 140 android:id="@+id/editText6" 141 android:layout_width="wrap_content" 142 android:layout_height="wrap_content" 143 android:layout_weight="1" 144 android:ems="10" /> 145 146 </LinearLayout> 147 148 <LinearLayout 149 android:layout_width="match_parent" 150 android:layout_height="wrap_content" > 151 152 <TextView 153 android:id="@+id/textView12" 154 android:layout_width="wrap_content" 155 android:layout_height="wrap_content" 156 android:text="联 系 人:" 157 android:textColor="@color/white" /> 158 159 <EditText 160 android:id="@+id/editText8" 161 android:layout_width="wrap_content" 162 android:layout_height="wrap_content" 163 android:layout_weight="1" 164 android:ems="10" /> 165 </LinearLayout> 166 167 <LinearLayout 168 android:layout_width="match_parent" 169 android:layout_height="wrap_content" > 170 171 172 173 <TextView 174 android:id="@+id/textView7" 175 android:layout_width="wrap_content" 176 android:layout_height="wrap_content" 177 android:text="联系电话:" 178 android:textColor="@color/white" /> 179 180 <EditText 181 android:id="@+id/editText7" 182 android:layout_width="wrap_content" 183 android:layout_height="wrap_content" 184 android:layout_weight="1" 185 android:ems="10" 186 android:inputType="phone" /> 187 188 </LinearLayout> 189 190 <LinearLayout 191 android:layout_width="match_parent" 192 android:layout_height="wrap_content" > 193 194 195 196 <TextView 197 android:id="@+id/textView8" 198 android:layout_width="wrap_content" 199 android:layout_height="wrap_content" 200 android:text="客户性质:" 201 android:textColor="@color/white" /> 202 203 <Spinner 204 android:id="@+id/spinner1" 205 android:layout_width="wrap_content" 206 android:layout_height="wrap_content" 207 android:layout_weight="1" /> 208 209 </LinearLayout> 210 211 <LinearLayout 212 android:layout_width="match_parent" 213 android:layout_height="wrap_content" > 214 215 216 217 <TextView 218 android:id="@+id/textView9" 219 android:layout_width="wrap_content" 220 android:layout_height="wrap_content" 221 android:text="客户来源:" 222 android:textColor="@color/white" /> 223 224 <Spinner 225 android:id="@+id/spinner2" 226 android:layout_width="wrap_content" 227 android:layout_height="wrap_content" 228 android:layout_weight="1" /> 229 230 </LinearLayout> 231 232 <LinearLayout 233 android:layout_width="match_parent" 234 android:layout_height="wrap_content" > 235 236 237 238 <TextView 239 android:id="@+id/textView10" 240 android:layout_width="wrap_content" 241 android:layout_height="wrap_content" 242 android:text="所在区域:" 243 android:textColor="@color/white" /> 244 245 <Spinner 246 android:id="@+id/spinner3" 247 android:layout_width="wrap_content" 248 android:layout_height="wrap_content" 249 android:layout_weight="1" /> 250 251 </LinearLayout> 252 253 <LinearLayout 254 android:layout_width="match_parent" 255 android:layout_height="wrap_content" > 256 257 258 <TextView 259 android:id="@+id/textView11" 260 android:layout_width="wrap_content" 261 android:layout_height="wrap_content" 262 android:text="客户状态:" 263 android:textColor="@color/white" /> 264 265 <Spinner 266 android:id="@+id/spinner4" 267 android:layout_width="wrap_content" 268 android:layout_height="wrap_content" 269 android:layout_weight="1" /> 270 </LinearLayout> 271 272 <LinearLayout 273 android:layout_width="match_parent" 274 android:layout_height="wrap_content" > 275 276 277 278 <TextView 279 android:id="@+id/textView13" 280 android:layout_width="wrap_content" 281 android:layout_height="wrap_content" 282 android:text="单位人数:" 283 android:textColor="@color/white" /> 284 285 <EditText 286 android:id="@+id/editText9" 287 android:layout_width="wrap_content" 288 android:layout_height="wrap_content" 289 android:layout_weight="1" 290 android:ems="10" 291 android:inputType="number" /> 292 293 </LinearLayout> 294 295 <LinearLayout 296 android:layout_width="match_parent" 297 android:layout_height="wrap_content" > 298 299 300 301 <TextView 302 android:id="@+id/textView14" 303 android:layout_width="wrap_content" 304 android:layout_height="wrap_content" 305 android:text="客户类别:" 306 android:textColor="@color/white" /> 307 308 <Spinner 309 android:id="@+id/spinner5" 310 android:layout_width="wrap_content" 311 android:layout_height="wrap_content" 312 android:layout_weight="1" /> 313 314 </LinearLayout> 315 316 <LinearLayout 317 android:layout_width="match_parent" 318 android:layout_height="wrap_content" > 319 320 321 322 <TextView 323 android:id="@+id/textView15" 324 android:layout_width="wrap_content" 325 android:layout_height="wrap_content" 326 android:text="客户级别:" 327 android:textColor="@color/white" /> 328 329 <Spinner 330 android:id="@+id/spinner6" 331 android:layout_width="wrap_content" 332 android:layout_height="wrap_content" 333 android:layout_weight="1" /> 334 335 </LinearLayout> 336 337 <LinearLayout 338 android:layout_width="match_parent" 339 android:layout_height="wrap_content" > 340 341 342 343 <TextView 344 android:id="@+id/textView16" 345 android:layout_width="wrap_content" 346 android:layout_height="wrap_content" 347 android:text="业务范围:" 348 android:textColor="@color/white" /> 349 350 <Spinner 351 android:id="@+id/spinner7" 352 android:layout_width="wrap_content" 353 android:layout_height="wrap_content" 354 android:layout_weight="1" /> 355 356 </LinearLayout> 357 358 <LinearLayout 359 android:layout_width="match_parent" 360 android:layout_height="wrap_content" > 361 362 363 364 <TextView 365 android:id="@+id/textView17" 366 android:layout_width="wrap_content" 367 android:layout_height="wrap_content" 368 android:text="所属行业:" 369 android:textColor="@color/white" /> 370 371 <Spinner 372 android:id="@+id/spinner8" 373 android:layout_width="wrap_content" 374 android:layout_height="wrap_content" 375 android:layout_weight="1" /> 376 377 </LinearLayout> 378 379 <LinearLayout 380 android:layout_width="match_parent" 381 android:layout_height="wrap_content" > 382 383 384 385 <TextView 386 android:id="@+id/textView18" 387 android:layout_width="wrap_content" 388 android:layout_height="wrap_content" 389 android:text="主要问题:" 390 android:textColor="@color/white" /> 391 392 <EditText 393 android:id="@+id/editText10" 394 android:layout_width="wrap_content" 395 android:layout_height="wrap_content" 396 android:layout_weight="1" 397 android:ems="10" 398 android:inputType="textMultiLine" /> 399 400 </LinearLayout> 401 402 403 404 <LinearLayout 405 android:layout_width="match_parent" 406 android:layout_height="wrap_content" 407 android:gravity="center" > 408 409 <Button 410 android:id="@+id/button1" 411 style="?android:attr/buttonStyleSmall" 412 android:layout_width="wrap_content" 413 android:layout_height="wrap_content" 414 android:layout_weight="0.11" 415 android:text="保存" /> 416 417 418 419 420 421 422 423 424 <Button 425 android:id="@+id/button2" 426 style="?android:attr/buttonStyleSmall" 427 android:layout_width="wrap_content" 428 android:layout_height="wrap_content" 429 android:layout_weight="0.12" 430 android:text="返回" /> 431 432 </LinearLayout> 433 434 </LinearLayout> 435 436 </ScrollView>