我有一个布局:
这是它的 XML
<ScrollView
android:id="@+id/mScroller"
android:layout_width="match_parent"
android:layout_height="80dp"
android:clipToPadding="false"
android:fillViewport="true"
android:fitsSystemWindows="false"
android:nestedScrollingEnabled="false"
>
<RelativeLayout
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="@color/black"
android:paddingTop="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/top_bar_title_height"
android:weightSum="11"
>
<ImageView
android:id="@+id/back_img"
android:layout_width="35dp"
android:layout_height="match_parent"
android:padding="@dimen/med_below_padding"
android:src="@drawable/back_arrow"
/>
<TextView
android:id="@+id/from_txt"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center_vertical"
android:paddingBottom="@dimen/min_padding"
android:paddingTop="@dimen/min_padding"
android:singleLine="true"
android:text="@string/id_my_business_card"
android:textColor="@color/white"
android:textSize="@dimen/normal_text"
/>
<TextView
android:id="@+id/textView8"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="7"
android:gravity="center"
android:text="@string/id_add_new_business_card"
android:textColor="@color/white"
android:textSize="@dimen/top_heading"/>
<TextView
android:id="@+id/textView_add"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="13dp"
android:layout_weight="2"
android:background="@drawable/white_border"
android:gravity="center"
android:src="@drawable/camerasection_flipcamera"
android:text="@string/add"
android:textColor="@color/white"
android:textSize="@dimen/normal_text"
/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/edit_message_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="70dp"
android:background="@drawable/border_top_rounded"
android:gravity="right"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="@dimen/med_below_padding">
<!--<ScrollView-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content">-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:orientation="vertical">-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView_profile"
android:layout_width="@dimen/drawer_header_height"
android:layout_height="@dimen/drawer_header_height"
android:layout_margin="@dimen/general_margin"
android:clickable="true"
android:visibility="gone"
app:srcCompat="@drawable/chatcontacticon"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/editText_firstname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/med_padding"
android:layout_marginLeft="@dimen/med_padding"
android:layout_marginRight="@dimen/med_padding"
android:layout_marginTop="@dimen/med_below_padding"
android:layout_weight="1"
android:background="@null"
android:ems="10"
android:gravity="left|center_vertical"
android:hint="@string/first_name"
android:inputType="textPersonName"
android:textColor="@color/black"
android:textColorHint="@color/grey_line"
android:textColorLink="@color/transparent"
android:textSize="@dimen/normal_text"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/med_padding"
android:layout_marginRight="@dimen/med_padding"
android:background="@color/new_chat_header"
/>
<EditText
android:id="@+id/editText_lastname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/med_padding"
android:layout_marginLeft="@dimen/med_padding"
android:layout_marginRight="@dimen/med_padding"
android:layout_marginTop="@dimen/med_padding"
android:layout_weight="1"
android:background="@null"
android:ems="10"
android:gravity="left|center_vertical"
android:hint="@string/last_name"
android:inputType="textPersonName"
android:textColor="@color/black"
android:textColorHint="@color/grey_line"
android:textColorLink="@color/transparent"
android:textSize="@dimen/normal_text"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/med_padding"
android:layout_marginRight="@dimen/med_padding"
android:background="@color/new_chat_header"
/>
<EditText
android:id="@+id/editText_company"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/med_padding"
android:layout_marginLeft="@dimen/med_padding"
android:layout_marginRight="@dimen/med_padding"
android:layout_marginTop="@dimen/med_padding"
android:layout_weight="1"
android:background="@null"
android:ems="10"
android:gravity="left|center_vertical"
android:hint="@string/company_name"
android:inputType="textPersonName"
android:textColor="@color/black"
android:textColorHint="@color/grey_line"
android:textColorLink="@color/transparent"
android:textSize="@dimen/normal_text"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/med_padding"
android:layout_marginRight="@dimen/med_padding"
android:background="@color/new_chat_header"
/>
<EditText
android:id="@+id/editText_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/med_padding"
android:layout_marginLeft="@dimen/med_padding"
android:layout_marginRight="@dimen/med_padding"
android:layout_marginTop="@dimen/med_padding"
android:layout_weight="1"
android:background="@null"
android:ems="10"
android:gravity="left|center_vertical"
android:hint="@string/address"
android:inputType="textPersonName"
android:textColor="@color/black"
android:textColorHint="@color/grey_line"
android:textColorLink="@color/transparent"
android:textSize="@dimen/normal_text"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/med_padding"
android:layout_marginRight="@dimen/med_padding"
android:background="@color/new_chat_header"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/min_padding"
android:layout_marginTop="@dimen/med_below_padding"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/general_forty"
android:layout_height="@dimen/general_forty"
android:padding="@dimen/med_below_padding"
app:srcCompat="@drawable/addbutton"/>
<EditText
android:id="@+id/editText_phone"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/med_padding"
android:layout_weight="1"
android:background="@null"
android:ems="10"
android:gravity="left|center_vertical"
android:hint="@string/phone_number"
android:inputType="number"
android:textColor="@color/black"
android:textColorHint="@color/grey_line"
android:textColorLink="@color/transparent"
android:textSize="@dimen/normal_text"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/med_padding"
android:layout_marginRight="@dimen/med_padding"
android:background="@color/new_chat_header"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/min_padding"
android:layout_marginTop="@dimen/med_below_padding"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/general_forty"
android:layout_height="@dimen/general_forty"
android:padding="@dimen/med_below_padding"
app:srcCompat="@drawable/addbutton"/>
<EditText
android:id="@+id/editText_office_phone"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/med_padding"
android:layout_weight="1"
android:background="@null"
android:ems="10"
android:gravity="left|center_vertical"
android:hint="@string/office_number"
android:inputType="number"
android:textColor="@color/black"
android:textColorHint="@color/grey_line"
android:textColorLink="@color/transparent"
android:textSize="@dimen/normal_text"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/med_padding"
android:layout_marginRight="@dimen/med_padding"
android:background="@color/new_chat_header"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/min_padding"
android:layout_marginTop="@dimen/med_below_padding"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/general_forty"
android:layout_height="@dimen/general_forty"
android:padding="@dimen/med_below_padding"
app:srcCompat="@drawable/addbutton"/>
<EditText
android:id="@+id/editText_addemail"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/med_padding"
android:layout_weight="1"
android:background="@null"
android:ems="10"
android:gravity="left|center_vertical"
android:hint="@string/email_address"
android:inputType="textPersonName"
android:textColor="@color/black"
android:textColorHint="@color/grey_line"
android:textColorLink="@color/transparent"
android:textSize="@dimen/normal_text"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/med_padding"
android:layout_marginRight="@dimen/med_padding"
android:background="@color/new_chat_header"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/min_padding"
android:layout_marginTop="@dimen/med_below_padding"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/general_forty"
android:layout_height="@dimen/general_forty"
android:padding="@dimen/med_below_padding"
app:srcCompat="@drawable/addbutton"/>
<EditText
android:id="@+id/editText_url"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/med_padding"
android:layout_weight="1"
android:background="@null"
android:ems="10"
android:gravity="left|center_vertical"
android:hint="@string/add_url"
android:inputType="textPersonName"
android:textColor="@color/black"
android:textColorHint="@color/grey_line"
android:textColorLink="@color/transparent"
android:textSize="@dimen/normal_text"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/med_padding"
android:layout_marginRight="@dimen/med_padding"
android:background="@color/new_chat_header"
/>
<TextView
android:id="@+id/del_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/med_padding"
android:background="@color/sharp_green"
android:padding="@dimen/med_below_padding"
android:text="@string/delete"
android:textColor="@color/white"
android:textSize="@dimen/btn_text"
android:visibility="gone"/>
<!--</LinearLayout>-->
<!--</ScrollView>-->
</LinearLayout>
</RelativeLayout>
现在,当我打开键盘时,它与底部的 EditText 重叠
我在清单中使用以下标签
android:windowSoftInputMode="stateHidden|adjustResize"
另外,如果我不在java中使用下面它工作正常
getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS ,WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
但我必须使用上面的行才能使状态栏半透明。总的来说,互联网上有实现欲望行为的代码,但都没有FLAG_TRANSLUCENT_STATUS
。
有什么帮助吗?
谢谢。