2017-09-16 1 views
0

차이가 나는 this처럼 보이는 대 생성자에서 다음 그리드 레이아웃을자 마린 목록보기 : 생성자와 에뮬레이터

<?xml version="1.0" encoding="utf-8"?> 
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:minWidth="25px" 
    android:minHeight="25px" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:columnCount="1" 
    android:rowCount="5"> 
    <ListView 
     android:minWidth="25px" 
     android:minHeight="25px" 
     android:layout_rowWeight="0.7" 
     android:layout_width="match_parent" /> 
    <TextView 
     android:text="Введите показания водомера" 
     android:textSize="24dp" 
     android:layout_rowWeight="0.05" 
     android:layout_width="match_parent" 
     android:gravity="center"/> 
    <EditText 
     android:inputType="number" 
     android:layout_rowWeight="0.03" 
     android:layout_width="match_parent" /> 
    <Button 
     android:text="Сделать фото" 
     android:textSize="20dp" 
     android:layout_rowWeight="0.05" 
     android:layout_width="match_parent" 
     android:gravity="center" /> 
    <Button 
     android:text="Отправить показания" 
     android:textSize="24dp" 
     android:layout_rowWeight="0.15" 
     android:layout_width="match_parent" 
     android:gravity="center" /> 
</GridLayout> 

을했습니다. 하지만 에뮬레이터에서 나는 this을 얻었습니다. 첫 번째 이미지처럼 ListView의 높이를 어떻게 설정할 수 있습니까?

+0

왜 'GridLayout'을 사용해야합니까? 하드 코딩 된'width'와'height'를 사용하면 원하는 것을 성취 할 수 있습니다. 왜 LinearLayout을 수직 배향의 컨테이너로 사용하고 왜곡 2와 1을 갖는 2 개의 LinearLayouts를 내부적으로 사용하지 않을 것입니다. 나는 두 번째 나머지 부분에'ListView'를 넣을 것입니다. – Yupi

+0

@Yupi'GridLayout'을 통해 differenct 장치의 컨트롤 크기를 조정할 수 있습니다. – NisuSan

답변

0

사용자 정의 android.support.v7을 nuget에서 내 프로젝트에 추가하고 XML 스키마를 사용하여이 문제를 해결할 수있는 방법을 발견했습니다.

<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:minWidth="25px" 
    android:minHeight="25px" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:columnCount="1" 
    app:rowCount="5"> 
</android.support.v7.widget.GridLayout> 
관련 문제