Android 编辑文本没有聚焦
下面是我的代码:Android 编辑文本没有聚焦,android,android-edittext,Android,Android Edittext,下面是我的代码: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" &g
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="@+id/app_owner"
android:layout_width="@dimen/comment_profilepic_width"
android:layout_height="@dimen/comment_profilepic_height"
android:adjustViewBounds="true"
android:background="@android:color/white"
android:src="@drawable/profile_picture" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:src="@drawable/newfeed_23" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_comment_bg"
android:orientation="vertical"
android:padding="10dp" >
<EditText
android:paddingLeft="6dp"
android:minHeight="50dp"
style="@style/WhiteNormalText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_comment_textbox"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:hint="Post your comment..." />
</LinearLayout>
</LinearLayout>
当我点击文本框时,它会先聚焦然后消失。我真的不知道这里发生了什么。任何帮助都将不胜感激请在.xml文件中尝试以下内容:
<EditText
android:paddingLeft="6dp"
android:id="@+id/editComment"
android:minHeight="50dp"
style="@style/WhiteNormalText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_comment_textbox"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:hint="Post your comment..." />
希望这对您有所帮助尝试在xmlno中添加setFocus=“true”仍然不起作用。是焦点问题还是其他问题
EditText editComment = (EditText) findViewById(R.id.editComment);
editComment.setFocusableInTouchMode(true);