2014-12-04 6 views
0

내부에 여러 개의 선형 레이아웃이있는 scrollview 레이아웃이 있습니다. scrollview의 마지막 뷰는 항상 화면 맨 아래에 나타나야하는 ImageView입니다. 보기의 내용이 동적이며 때로는 화면을 스크롤해야 할 때가 있습니다. 화면을 스크롤해야하는 경우 ImageView가 맨 아래에 올바르게 표시됩니다. 사진을보세요. 이것은 스크롤 된 화면의 예이고, imageView는 녹색 막대입니다. enter image description here앵커 이미지 뷰 스크롤 뷰 레이아웃 하단보기

이것은 스크롤 할 필요가없는 화면의 예입니다. 알 수 있듯이 이미지보기는 텍스트보기 바로 아래에 표시됩니다.

enter image description here

그리고 여기에 내 현재 XML 파일입니다

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    > 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     > 

     <ImageView 
      android:id="@+id/imagen_view11" 
      android:layout_width="fill_parent" 
      android:layout_height="60dp" 
      android:scaleType="fitXY" 
      android:src="@drawable/sector1" /> 

     <ImageView 
      android:id="@+id/imagen_view" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:scaleType="fitXY" 
      android:src="@drawable/actpercusion" /> 

     <TextView 
      android:id="@+id/titulo_label" 
      android:layout_width="fill_parent" 
      android:layout_height="match_parent" 
      android:gravity="center_horizontal" 
      android:text="TextView TextView TextView TextView" 
      android:textSize="25sp" 
      android:textStyle="bold" /> 

<TextView 
     android:id="@+id/lugar_label" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:text="TextView" /> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" > 

    <RelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:gravity="right" > 

     <ImageButton 
      android:id="@+id/boton_web" 
      android:layout_width="80dp" 
      android:layout_height="80dp" 
      android:layout_alignParentRight="true" 
      android:scaleType="fitXY" 
      android:src="@drawable/web" 
      android:text="Button web" /> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_toLeftOf="@+id/boton_web" 
      android:orientation="vertical" > 

      <ImageButton 
       android:id="@+id/boton_mapa" 
      android:layout_width="80dp" 
      android:layout_height="80dp" 
      android:scaleType="fitXY" 
      android:src="@drawable/maps" 
      android:onClick="openMapa" 
       android:text="Button mapa" /> 
     </LinearLayout> 
    </RelativeLayout> 

</LinearLayout> 

<TextView 
    android:id="@+id/descripcion_texto" 
    android:layout_width="fill_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1" 
    android:text="TextView" /> 
<ImageView 
      android:id="@+id/imagen_v" 
      android:layout_width="fill_parent" 
      android:layout_height="60dp" 
      android:scaleType="fitXY" 
      android:layout_alignParentBottom="true" 
      android:src="@drawable/sector3" /> 

    </LinearLayout> 



</ScrollView> 

I 화면 경우 이미지보기는 항상 독립적으로, 화면 하단에 나타나도록 내 레이아웃 파일을 변경해야 스크롤해야하는지 여부. 도움이됩니다.

답변

2

당신은 안드로이드를 사용해야합니다 : fillViewport

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/scroller" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:fillViewport="true" > 

는 로맹 사람에 의해 쓰여진이 blog page를 참조하십시오.

+0

감사합니다. 지금 확인하겠습니다 ... – novato

+0

Goran, 작동하지 않습니다 ... 나중에 다시 시도하고 일부 값을 변경합니다. – novato

+0

어떻게 문제를 해결 했습니까? –

관련 문제