Edittext 不自动获取焦点

在父控件里面加上两条属性

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

具体例子

 <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="15dp"
                android:paddingLeft="30dp"
                android:paddingRight="30dp"
                android:focusable="true"
                android:focusableInTouchMode="true">
 
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="流水号"
                    android:textColor="@android:color/black"
                    android:textSize="16sp"/>
 
                <EditText
                    android:id="@+id/etTraceNo"
                    android:layout_width="0dip"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:background="@null"
                    android:gravity="end"
                    android:inputType="number"
                    android:maxLength="6"
                    android:text="000001"
                    android:textSize="16sp"/>
            </LinearLayout>
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容