在这次项目开发中,遇到一个特别长的页面,刚好输入框 EditText
在底部,点击输入,根本看不见输入框在哪里,外面是 scrollview
,页面也滚动。
首先这是我原先的代码:
<EditText
android:id="@+id/tv_baoe_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/arrow4"
android:hint="请输入"
android:layout_alignParentRight="true"
android:background="@android:color/transparent"
android:textColor="@color/calulator_Weight"
android:textSize="@dimen/text_h16" />
我的background直接设置成透明的。结果就出现上述的问题。
解决方案:
<1>把背景设置drawable. shape_et_bg
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@android:color/transparent" />
</shape>
然后editText再引进去。
<EditText
android:layout_toRightOf="@id/tv_baoe"
android:id="@+id/tv_baoe_str"
android:gravity="right|center_vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/arrow4"
android:hint="请输入"
android:layout_alignParentRight="true"
android:background="@drawable/shape_et_bg"
android:textColor="@color/calulator_Weight"
android:textSize="@dimen/text_h16" />
最后输入框就不会被遮挡了。
网友评论