2014-11-24 5 views
3

몇 가지 XML 활동 파일을 만들었습니다. 나는 약간의 코드를 썼다. 나는 scrollview를 사용하고이 scrollview는 작동하지 않는다.android scrollview not working

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:layout_height="match_parent" 
android:fillViewport="true" 
android:background="#171717" > 

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

    <RelativeLayout 
     android:id="@+id/relativeLayout1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_marginBottom="22dp" 
     android:background="#171717" > 

     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_centerVertical="true" 
      android:layout_marginBottom="15dp" 
      android:layout_marginRight="15dp" 
      android:background="@drawable/ic_launcher" /> 

     <EditText 
      android:id="@+id/editText1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignBottom="@+id/imageView1" 
      android:layout_alignParentLeft="true" 
      android:layout_alignTop="@+id/imageView1" 
      android:layout_marginLeft="15dp" 
      android:layout_marginRight="5dp" 
      android:layout_toLeftOf="@+id/imageView1" 
      android:background="#363636" 
      android:paddingLeft="10dp" 
      android:textColor="#ffffff" > 
     </EditText> 
    </RelativeLayout> 

    <TextView 
     android:id="@+id/latteryresult" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/circlelayout2" 
     android:layout_centerHorizontal="true" 
     android:layout_marginBottom="28dp" 
     android:gravity="center" 
     android:text="click the button" 
     android:textColor="#ffffff" 
     android:textSize="17dp" /> 

    <RelativeLayout 
     android:id="@+id/circlelayout2" 
     android:layout_width="250dp" 
     android:layout_height="250dp" 
     android:layout_centerHorizontal="true" 
     android:layout_marginBottom="14dp" 
     android:layout_marginTop="15dp" > 


    </RelativeLayout> 
    </RelativeLayout> 

</ScrollView> 

텍스트 편집을 클릭하면 키보드가 표시됩니다. 그러면 스크롤 할 수 없습니다. 스크롤보기가 작동하지 않습니다. 내가 뭘 잘못하고 있니? 누구든지 해결책을 알고 있다면 나를 도와주세요.

+0

레이아웃에 ScrollView가 없습니다. – atok

+0

@atok scrollview가 루트보기입니다 – tyczj

+0

manifest에 android : windowSoftInputMode를 설정 했습니까? 기본값으로 작동해야하지만 "adjustPan"으로 설정하면 작동하지 않습니다. – atok

답변

0

첫 번째 RelativeLayoutandroid:layout_heightwrap_content이어야합니다.

match_parent은 (보이는) 높이보다 더 크게보기를 허용하지 않기 때문에 ScrollView입니다.

+0

wrapcontent 스크롤이 작동하지만 내용이 올라가고 있습니다. 무게가 작동하지 않고 무게 중심도 작동하지 않습니다. –

+0

entair 화면이있는 화면 하단에 내용을 가져 오는 다른 솔루션이 있습니다. –

+0

@mvnkalyani 정확히 무엇을 좋아할지를 약간 보여 주시겠습니까? 왜냐하면'android : layout_alignParentBottom = "true"'스크롤 할 수있는 것은 그리 적절하지 않기 때문입니다. –