Android 不自动显示软纸板
在我的xml布局中:Android 不自动显示软纸板,android,material-design,Android,Material Design,在我的xml布局中: <com.google.android.material.textfield.TextInputEditText android:id="@+id/nameTextInputEditText" style="@style/textViewOneLine" android:layout_width="0dp" android:layout_height="wrap_con
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/nameTextInputEditText"
style="@style/textViewOneLine"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/default_margin"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="@string/name"
android:textColor="@android:color/white"
android:textColorHint="@android:color/white"
android:textSize="17sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolBarContainer" />
尽管如此,这应该是可行的 确保父布局不是可聚焦模式。还要确保父布局是相对布局或线性布局 如果所有这些都失败,请尝试以下操作: 将此添加到onCreate after setContentView中的主活动中。让我们看看会发生什么
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
尝试将其添加到xml布局中
android:focusedByDefault="true"
可能的重复在重复的问题中有很多解决方案,我建议它的影响较小我使用API=23,所以不能使用android:focusedByDefault
android:focusedByDefault="true"