마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

tablerow를 이용한 화면구성

+1 추천
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="20dp"
        android:text="내 기록"
        android:textSize="35sp"/>
    <TableLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
        <View 
            android:layout_width="match_parent"
            android:background="#999999"
            android:layout_height="1dp"/>
        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="1dp"
                android:layout_marginLeft="1dp"
                android:padding="3dp"
                android:gravity="center"
                android:text="점수"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="1dp"
                android:layout_marginLeft="1dp"
                android:gravity="center"
                android:padding="3dp"
                android:text="날짜" />
         </TableRow>
         <TableRow
             android:layout_width="match_parent"
             android:layout_height="wrap_content">
             <ListView
                 android:id="@+id/scoreList"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content" >
             </ListView>
         </TableRow>
    </TableLayout>
</LinearLayout>

 

위와같은 화면을 구성하기위해 위처럼 xml을 작성했습니다..

 

그런데 테이블의 타이틀부분인 '날짜'와 '점수' 부분에서 점수가 자리를 다 차지해서

'날짜'글씨가 안보입니다.. 인터넷 다른 예제를 보아도 위와같이 되어있었는데

뭐가 문제인지 두 개가 균등하게 안나오고 점수 텍스트뷰가 가로길이를 다 차지해버립니다..

이유를 도저히 모르겠습니다 ㅠㅠ

익명사용자 님이 2015년 3월 3일 질문

1개의 답변

+1 추천
자답 : ListView의 width가 wrap_content 였던것이 원인이었습니다..

width를 50dp로 줄여보니 바로 바뀌네요..

근데 문제는 리스트뷰에 점수와 날짜를 한번에 넣고싶은데 어찌넣어야할지 모르겠네요..
익명사용자 님이 2015년 3월 3일 답변
...