2016-06-17 1 views
0

전체 화면에서 상대 레이아웃을 채울 수 없습니다. 예를 들어 바닥에 다른 레이아웃을 만들 때 그는 마지막 레이아웃 이후에 나타납니다. 이안드로이드 전체 화면으로 스크롤보기 내 상대 레이아웃을 채우는 방법

<ScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    tools:context=".android_app_activity.EspacePersonnelActivity" 
    android:layout_width="fill_parent" 
    android:background="@drawable/ep_background" 
    android:id="@+id/espacePersonnelLayout" 
    android:layout_height="fill_parent"> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    >... 

답변

1

그것은 정상이하는있는 ScrollView 내 코드입니다 - 하나를 가질 수있는 모든 화면 공간을 자식 -, 그래서 당신은 추가 할 모든 말에 표시됩니다.

1

항상 scrollview의 하위 높이를 wrap_content로 유지해야합니다. 전체 화면을 채우려면 스크롤보기의 fillViewport 속성을 사용할 수 있습니다.

<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" 
    tools:context="com.example.jeshtamsru.tntrains.DashboarsActivity"> 
    <ScrollView 
     android:layout_width="match_parent" 
     android:fillViewport="true" 
     android:layout_height="wrap_content"> 
     <LinearLayout android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 
      <RelativeLayout 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal" 
       android:layout_gravity="center_horizontal"> 
       <Button 
         android:layout_width="wrap_content" 
         android:width="300dp" 
         android:gravity="center" 
         android:layout_height="wrap_content" 
         android:text="chennai to coimbatore"/> 
      </RelativeLayout> 
      <RelativeLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:layout_gravity="center_horizontal"> 
      <Button 
       android:layout_width="wrap_content" 
       android:width="300sp" 
       android:gravity="center" 
       android:layout_height="wrap_content" 
       android:text="chennai to coimbatore"/> 
     </RelativeLayout> 
    </LinearLayout> 
</ScrollView> 
</LinearLayout> 

는 당신이

를 :) 도움이되기를 바랍니다 - 다음은 작업 예입니다