Android-材质EditText

问题描述 投票:-1回答:1

我已经创建了一个实质性的edittext(我想这是因为它是我的初学者,所以我是Android App开发的新手。)它在对话框中,但我始终专注于开始,但我不希望它专注于开始。有人能帮助我吗??我的代码:final android.support.design.widget.TextInputLayout Tlay=new android.support.design.widget.TextInputLayout(MainActivity.this); Tlay.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); linear1.addView(Tlay); final android.support.design.widget.TextInputEditText EditText1=new android.support.design.widget.TextInputEditText(MainActivity.this); EditText1.setHint("Material EditText"); EditText1.setLayoutParams(new LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT)); Tlay.addView(EditText1);

android android-layout android-edittext
1个回答
0
投票

我邀请您,在显示对话框时,您想隐藏软键盘。如果我是对的,那么您应该尝试在[查看根目录]中设置android:focusableInTouchMode="true"

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical"
              android:focusableInTouchMode="true"
              android:padding="16dp"
              tools:context=".MainActivity">
<!-- Child views -->
</LinearLayout>

如果要将指针从EditText移动到其他指针。您应该观看the tutotial(在16:00)。

希望有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.