2

소프트웨어 키보드가있는 경우 목록보기 크기를 조정할 때 약간 문제가 있습니다. 기본적으로 내지도는 투명한 액션 바를 사용하여 전체 화면을 덮는 google maps api를 사용하고 있습니다. 오른쪽에서 슬라이드를 가져 와서지도에있는 vehicels 목록이 있습니다. 오른쪽 창 밖으로 경우 전체 레이아웃은 다음과 같습니다 : 내가 편집 텍스트를 집중하고 키보드 밖으로 슬라이드 할 때 내가 사용하고 enter image description here 이제키보드가있는 경우 목록보기 크기 조정

android:windowSoftInputMode="adjustPan" 그래서, 그것은 다음과 같습니다 enter image description here

느릅 나무가 잘되지 않기 때문에 그럴 수 없어 차량 전체를 보라. android:windowSoftInputMode="adjustResize"을 사용해 보았습니다. 그러나 투명한 액션 바를 사용하고 있기 때문에 다음과 같은 일이 발생합니다. enter image description here 전체 listView를 볼 수 있으며 멋지게 스크롤되지만 내 EditText는 이제 ActionBar 아래에 있습니다. 기본적으로 내가 무엇을 달성하고자하는 것은이 같이 있도록 두 경우 모두의 조합입니다 : enter image description here 지금이 조각에 대한 레이아웃은 내 목록

<?xml version="1.0" encoding="utf-8"?> 
<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/bg" 
    tools:context="hidden"> 

    <EditText 
     android:id="@+id/vehicle_search_edit_text" 
     android:layout_width="fill_parent" 
     android:layout_height="45dp" 
     android:focusable="true" 
     android:hint="Search" 
     android:imeOptions="actionSearch" 
     android:singleLine="true" /> 

    <ListView 
     android:id="@+id/list_vehicles" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_below="@+id/vehicle_search_edit_text" 
     android:animateLayoutChanges="true" 
     android:fastScrollEnabled="true" 
     /> 
</RelativeLayout> 

함께 그리고 이것은 내 MainActivity의 레이아웃입니다

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/layout_root" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <RelativeLayout 
     android:id="@+id/layout_root_map" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

    <RelativeLayout 
     android:id="@+id/layout_root_vehicles" 
     android:layout_width="350dp" 
     android:layout_height="match_parent" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" /> 

    <RelativeLayout 
     android:id="@+id/layout_root_settings" 
     android:layout_width="300dp" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" /> 

</RelativeLayout> 

나는 레이아웃의 높이를 프로그램 적으로 설정하는 것에 익숙하다. 왜냐하면 나는 이미 listfragment가 중첩 된 레이아웃을 가지고 있기 때문이다. 액션 바는 사장님이 원하는 방식으로 투명해야합니다. 나는 하루 종일 해결책을 찾고 있었지만 나를 찾은 것은 아무것도 찾지 못했기 때문에 어떤 도움을 주셔서 감사합니다.

답변

3

나는 당신의 액션 바가 예를 들어 Google지도에서 사용되는 것과 비슷하기 때문에, 보통 당신이 사용하는 공간은 다른 레이아웃, 경우에 따라 그 조각에 사용할 수 있다고 생각한다. 시도해보고 조각 컨테이너에 대해 여백이나 여백을 지정하십시오.

android:paddingTop="?android:attr/actionBarSize" 

(작업 표시 줄의 크기). 이 작업을해야

android:windowSoftInputMode="adjustResize" 

와 함께

.

패딩 값이 사용자를 만족시키지 못하는 경우 수동으로보다 적절한 값을 제공하십시오.

+0

MainActivity.xml을 변경하고 alignParentBottom을 alignParentTop으로 변경해야했지만이 방법이 효과적입니다. 답변으로 표시했습니다. –

+0

android : paddingTop = "? android : attr/actionBarSize와 함께 작동 했습니까? 값을 바꾸려면? 내가 직접 테스트 할 기회가 없기 때문에 묻고있다. –

+0

네, 완벽하게 작동합니다. 자신을 알아 내지 못했다고는 믿을 수 없습니다. –

0

매니페스트 파일에서 활동에 android:windowSoftInputMode="adjustPan"을 추가하십시오. 예를 들어,

<activity 
      android:name="com.sample.ListViewsActivity" 
      android:label="@string/app_name" 
      android:screenOrientation="portrait" 
      android:windowSoftInputMode="adjustPan" > 
     </activity> 

이 문제는 귀하의 문제를 해결합니다. 그냥 시도해보십시오.

+0

지금은'android : windowSoftInputMode = "adjustPan"'을 사용하고 있으며 두 번째 그림처럼 보입니다. 제 질문에이 점이 나와있어서 저에게 적합하지 않습니다. –

0

API는 다음 http://developer.android.com/reference/android/widget/ListView.html

TRANSCRIPT_MODE_ALWAYS_SCROLL는 = 목록은 자동 상관없이 현재 볼 수 있습니다 어떤 항목 아래로 스크롤하지 않습니다 말한다.

setTranscriptMode (int mode) = 목록 또는 격자를 스크립트 모드로 전환합니다.

시험 작동 여부를 확인하십시오.

setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL); 

.

관련 문제