상단에 RelativeLayout이 있고 그 아래에 가운데에 ListView가 있으며 마지막으로 하단에 EditText와 Button이있는 또 다른 relativeLayout이 있습니다.키보드가 내 EditText를 숨기는 것을 방지하려면 어떻게해야합니까?
EditText를 클릭하면 IME (가상 키보드)가 표시 될 때 ListView의 크기가 조정되기를 원합니다. 내가 매니 페스트에 adjustResize를 넣으면, IME를위한 공간을 남겨두기 위해리스트 뷰의 크기가 조정되지만 아래의 EditText가있는 RelativeLayout은 IME에 의해 처리되고 내가 쓰고있는 것을 볼 수 없습니다. adjustPan을두면 키보드가 모두 위로 밀리고 ListView의 크기가 조정되지 않고 상단의 RelativeLayout이 풀립니다.
내 코드 : 당신은 명시 적 픽셀 값과의 layout_width와 layout_heights을 설정해서는 안
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/application_background"
android:paddingLeft="15px"
android:paddingRight="15px"
android:paddingTop="15px"
android:paddingBottom="15px">
<RelativeLayout
android:id="@+id/rlyParentPost"
android:orientation="vertical"
android:layout_width="450px"
android:layout_height="85px"
android:background="@drawable/app_gradient_color"
android:layout_centerHorizontal="true">
<ImageView
android:id="@+id/imgUserOfParent"
android:layout_marginLeft="10px"
android:layout_marginTop="10px"
android:background="@drawable/userfeed"
android:layout_width="64px"
android:layout_height="64px"
android:layout_below="@+id/logoImg">
</ImageView>
<TextView
android:layout_below="@+id/logoImg"
android:layout_toRightOf="@+id/imgUserOfParent"
android:id="@+id/lblNameOfParent"
android:textSize="17px"
android:textStyle="bold"
android:layout_marginLeft="5dip"
android:layout_marginTop="11dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff">
</TextView>
<TextView
android:layout_below="@+id/lblNameOfParent"
android:layout_toRightOf="@+id/imgUserOfParent"
android:id="@+id/lblBodyOfParent"
android:textColor="#ffffff"
android:textSize="17px"
android:layout_marginLeft="5dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<TextView
android:layout_below="@+id/lblBodyOfParent"
android:layout_toRightOf="@+id/imgUserOfParent"
android:id="@+id/lblDateOfParent"
android:textColor="#70ccff"
android:textSize="11px"
android:layout_marginLeft="7dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rlyParentPost"
android:id="@+id/contentLayout">
<ListView
android:isScrollContainer="true"
android:id="@+id/lsvComments"
android:layout_height="515px"
android:layout_width="450px"
android:background="#ffffff"
android:listSelector="@drawable/multi_white_color"
android:drawSelectorOnTop="false"
android:divider="#9aa5ac"
android:cacheColorHint="#00000000"
android:dividerHeight="1px">
</ListView>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dip"
android:layout_below="@+id/lsvComments"
android:background="@drawable/app_gradient_comments"
android:id="@+id/contentLayout">
<EditText
android:inputType="text"
android:id="@+id/txtComment"
android:hint="What are you working on?"
android:textSize="22px"
android:layout_marginLeft="8px"
android:layout_height="72px"
android:layout_width="344px">
</EditText>
<Button
android:layout_toRightOf="@+id/txtComment"
android:id="@+id/cmdShare"
android:layout_width="79px"
android:layout_height="65px"
android:background="@drawable/feed_comments_multi_stage"
android:layout_marginLeft="7px">
</Button>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
감사의 말에 의해 Mayra는 당신이 말한 것을 시도했습니다. 나는 fill_parent에 넣은 listview를 제외하고 모두 wrap_content에 넣었습니다. 하지만 활동을 시작할 때 상단의 첫 번째 레이아웃과 아래의리스트 뷰를 모두 보았지만 EditText로 하단 레이아웃을 잃어 버렸기 때문에 edittext를 클릭해도 표시되지 않았습니다. 키보드 – Luciano
레이아웃 참조가 "@ + id"를 사용 중입니다. 무언가가 아래, 다음 등, 다른 것을 지정하면, 상대적인 것으로 설정하는보기가 먼저 와야합니다.그리고 당신은 이미'android : layout_toRightOf = "@ id/txtComment"를 사용하여 선언 된 ID를 주어야합니다. – Falmarri
외부 RelativeLayout을 orientation = "vertical"인 LinearLayout으로 바꿀 수 있어야합니다. 또한 레이아웃 디버깅을위한 좋은 도구는 SDK의 tools 디렉토리에있는 HeirarchyViewer입니다. 레이아웃이 어떻게 생각되는지 시각화합니다. –