2016-10-08 3 views
1

스크롤보기를 만들려고합니다. 내 응용 프로그램에 텍스트 필드가 있고 키보드를 열면 전체 화면이 위로 이동하고 스크롤하여 화면에 올라가는 것을 볼 수 있습니다.스크롤보기가 제대로 작동하지 않습니다.

내 스크롤보기에는 텍스트 필드와 일부 이미지보기가 화면에 표시됩니다.

다음 높이 당신의 linearLayoutmatch_parent 너무해야 당신이 당신의 ScrollView's 높이를 설정하는 데 필요한 모든의
<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:scrollbars="vertical" 
    android:fillViewport="true" 
    android:id="@+id/scrollView2" > 

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

     <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="fill_parent" 
       android:layout_height="60dp" 
       android:layout_marginTop="30dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="Total Lives :" 
        android:id="@+id/textView12" 
        android:layout_marginTop="8dp" 
        android:layout_marginLeft="20dp" /> 

       <ImageView 
        android:layout_width="40dp" 
        android:layout_height="40dp" 
        android:id="@+id/lifeImage1" 
        android:src="@drawable/full_brain_game" /> 

       <ImageView 
        android:layout_width="40dp" 
        android:layout_height="40dp" 
        android:id="@+id/lifeImage2" 
        android:src="@drawable/full_brain_game" /> 

       <ImageView 
        android:layout_width="40dp" 
        android:layout_height="40dp" 
        android:id="@+id/lifeImage3" 
        android:src="@drawable/full_brain_game" /> 

       <ImageView 
        android:layout_width="40dp" 
        android:layout_height="40dp" 
        android:id="@+id/lifeImage4" 
        android:src="@drawable/full_brain_game" /> 

       <ImageView 
        android:layout_width="40dp" 
        android:layout_height="40dp" 
        android:id="@+id/lifeImage5" 
        android:src="@drawable/full_brain_game" /> 

       <ImageView 
        android:layout_width="40dp" 
        android:layout_height="40dp" 
        android:id="@+id/lifeImage6" 
        android:src="@drawable/full_brain_game" /> 
      </LinearLayout> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
      android:id="@+id/textView7" 
      android:layout_marginLeft="150dp" 
      android:textColor="@color/red" 
      android:layout_marginTop="150dp" /> 

     <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/imageView" 
      android:src="@drawable/full_brain_game_1" /> 

    </LinearLayout> 
</ScrollView> 

답변

0

match_parent폭입니다. 그러면 모든게 괜찮아 질거야. RelativeLayout의 같은

0

변경있는 ScrollView의 자식으로 다음과 RelativeLayout의 내부 선형 레이아웃을 추가

<ScrollView 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fillViewport="true" > 

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

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

       <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" /> 

       <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" /> 

     </LinearLayout> 

    </RelativeLayout> 

+0

아무도 나를 위해 일하지 않았습니다. 아무도 모른다면 다른 해결책이 있습니까? –

0
<?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" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical"> 

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fillViewport="true"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 


      <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:gravity="center"> 
      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:gravity="center" 
       android:textStyle="bold" 
       android:id="@+id/txtsignup" 
       android:text="Register Here" 
       android:textSize="30dp" 
       android:padding="10dp"/> 
     </LinearLayout> 
    </LinearLayout> 

</ScrollView> 

</LinearLayout> 

이 시도하고 선형 레이아웃에 귀하의 의견을 계속 추가.

관련 문제