2012-03-14 3 views
0

그래서 나는 어떤 종류의 테스트를 받았고 도움이 필요합니다. 안드로이드의 초보자입니다. 텍스트 뷰 옆에 사용자의 점수를 게시하려면 어떻게해야합니까? 별도의보기입니까? 내가 달성하고자하는이Android : 동적 점수 배치

enter image description here

나는 텍스트 뷰 옆에 XML에 배치하는 방법입니다 무엇을 의미. 어떤 도움을 주시겠습니까? 이것에 대한 의견이 필요합니다. 선형 레이아웃에서 2 선형 레이아웃? 또는 1 선형 레이아웃 및 1 선형 레이아웃/1 relativelayout 아래의 상대 레이아웃?

답변

1

이 같은 RelativeLayout을 시도 할 수 :

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:text="hi gel" /> 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@id/textView1" 
     android:text="Your score" /> 

    <TextView 
     android:id="@+id/textView3" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_alignParentRight="true" 
     android:text="61.5" /> 

</RelativeLayout> 
1
//text.xml 

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="#ffffff" 
    > 
    <TextView 
        android:textStyle="bold" 
        android:id="@+id/hitext" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="10dp" 
        android:layout_marginLeft="10dp" 
        android:text="Hi Gel," 
        android:textColor="#000000" /> 

    <TextView 
        android:textStyle="bold" 
        android:layout_below="@+id/hitext" 
        android:id="@+id/scoretext" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="10dp" 
        android:layout_marginLeft="10dp" 
        android:text="Your LifeStyle score is:" 
        android:textColor="#000000" /> 
    <TextView 
        android:textStyle="bold" 

        android:layout_marginRight="10dp" 
        android:id="@+id/score" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
       android:layout_alignParentRight="true" 
        android:layout_alignBaseline="@+id/scoretext" 
        android:text="61.5" 
        android:textSize="50dp" 
        android:textColor="#000000" /> 

</RelativeLayout>