2017-01-30 2 views
1

ConstraintLayout을 사용하려고하는데 간단한 목록보기를 만들고 있습니다. 하지만 목록보기에서 문제가 스크롤되지 않습니다 그래서 스크롤 뷰를 부모로 넣으려면 노력하고 ListView 넣어 안에 있지만 난 단지 1 항목 있어요.목록보기에서 단 하나의 항목이 있습니다

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:orientation="vertical" android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <EditText 
     android:layout_width="0dp" 
     android:layout_height="48dp" 
     android:inputType="textPersonName" 
     android:text="Name" 
     android:ems="10" 
     android:id="@+id/editText" 
     android:layout_marginTop="10dp" 
     app:layout_constraintTop_toTopOf="parent" 
     android:layout_marginEnd="10dp" 
     app:layout_constraintRight_toRightOf="parent" 
     android:layout_marginRight="10dp" 
     android:layout_marginStart="10dp" 
     app:layout_constraintLeft_toLeftOf="parent" 
     android:layout_marginLeft="10dp" /> 

    <RadioGroup 
     android:layout_width="0dp" 
     android:layout_height="37dp" 
     android:layout_marginEnd="10dp" 
     app:layout_constraintRight_toRightOf="parent" 
     android:layout_marginRight="10dp" 
     android:layout_marginTop="10dp" 
     app:layout_constraintTop_toBottomOf="@+id/editText" 
     android:layout_marginStart="10dp" 
     app:layout_constraintLeft_toLeftOf="parent" 
     android:layout_marginLeft="10dp" 
     android:orientation="horizontal" 
     android:id="@+id/radioGroup"> 

     <RadioButton 
      android:text="To Ferenhite" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/ctof" 
      android:layout_weight="1" /> 

     <RadioButton 
      android:text="To Celcius" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/ftoc" 
      android:layout_weight="1" /> 
    </RadioGroup> 

    <Button 
     android:text="Button" 
     android:layout_width="0dp" 
     android:layout_height="51dp" 
     android:id="@+id/btn_convert" 
     android:layout_marginStart="10dp" 
     app:layout_constraintLeft_toLeftOf="parent" 
     android:layout_marginLeft="10dp" 
     android:layout_marginEnd="10dp" 
     app:layout_constraintRight_toRightOf="parent" 
     android:layout_marginRight="10dp" 
     android:layout_marginTop="10dp" 
     app:layout_constraintTop_toBottomOf="@+id/radioGroup" /> 

    <ScrollView 
     android:layout_width="0dp" 
     android:layout_height="329dp" 
     android:layout_marginEnd="10dp" 
     app:layout_constraintRight_toRightOf="parent" 
     android:layout_marginRight="10dp" 
     android:layout_marginStart="10dp" 
     app:layout_constraintLeft_toLeftOf="parent" 
     android:layout_marginLeft="10dp" 
     android:layout_marginTop="8dp" 
     app:layout_constraintTop_toBottomOf="@+id/btn_convert" 
     app:layout_constraintBottom_toBottomOf="parent" 
     android:layout_marginBottom="5dp"> 

     <ListView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/list_temperature" /> 
    </ScrollView> 
</android.support.constraint.ConstraintLayout> 

lenier 레이아웃에서 UI를 만든 다음 변환하려고했지만 나에게 적합하지 않습니다. 모든 구성 요소가 방해 받았다. scrollview 제거 할 수 및 ListView 너무 넣어 있지만 작동하지 않습니다. 그걸 도와주세요. 미리 감사드립니다.

답변

0

스크롤보기 내에서 목록보기를 사용할 수 없습니다.

+0

나는 목록보기만이 왜 그렇게 시도했는지 알지 못한다. –

+0

스크롤보기가없는 xml을 보여주세요 – SteelBytes

0

당신은 ListView에 어댑터를 할당해야합니다. ListView에 항목을 어떻게 추가하고 있습니까? 어댑터를 사용하는 경우 어댑터를 게시하십시오.

+0

그는 1 개의 아이템이 있다고 말했고 아마도 그 어댑터가 있음을 의미 할 수 있습니다. – Enzokie

관련 문제