0
我有AdjustPan我所有的佈局設置爲:AdjustPan不是在某些佈局工作
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowSoftInputMode">adjustPan</item>
</style>
但是有一個包含幾個靜態片段的地方,如果我點擊的片段裏面的文本框一個佈局,背景圖像大小調整,並且與父母一致的觀點升高。
我試圖清單設置爲:
<activity
android:name=".CaptureVisitActivity"
android:label="@string/title_activity_capture_visit"
android:windowSoftInputMode="adjustPan" >
但同樣,調整窗口的大小。
這是佈局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_landscape"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".CaptureVisitActivity" >
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:text="@string/title_activity_capture_visit"
android:textAppearance="?android:attr/textAppearanceLarge" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/tv_title"
android:layout_centerHorizontal="true"
android:layout_marginBottom="90dp"
android:baselineAligned="false" >
<ScrollView
android:id="@+id/sv1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.3" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<fragment
android:id="@+id/frag_summary"
android:name="com.vancert.activities.CaptureVisitActivity$JobSummaryFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout="@layout/fragment_job_summary" />
<fragment
android:id="@+id/frag_further_work"
android:name="com.vancert.activities.CaptureVisitActivity$JobFurtherWorkFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout="@layout/fragment_further_work" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.3"
android:orientation="vertical" >
<fragment
android:id="@+id/fragment1"
android:name="com.vancert.activities.CaptureVisitActivity$JobReportsFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout="@layout/fragment_job_reports" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.3"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/container_job_appliances"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</FrameLayout>
</LinearLayout>
</LinearLayout>
<include
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
layout="@layout/layout_footer" />
</RelativeLayout>
和fragment_job_summary是:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/summary"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/engineer_notes_label" />
<Button
android:id="@+id/btn_fast_text"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:background="@drawable/background_button4"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/fasttext" />
</LinearLayout>
<EditText
android:id="@+id/et_eng_notes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:maxLines="3" >
</EditText>
</LinearLayout>
</LinearLayout>
有什麼建議?
使用adjustResize而不是 – santalu 2014-10-02 11:08:46
@santalu我找到了答案。它與scrollview有關。 adjustResize不會解決問題,因爲這正是我想要避免的......調整背景。但謝謝你的答案 – 2014-10-02 11:11:23