0
아직 안드로이드에 상당히 익숙하지 않은 나는 디자이너와 똑같이 보이는 스케치를 만드는 임무가있다. 선형 레이아웃과 가중치를 사용하여 시도하여 요소가 해상도와 상관없이 배경과 동일한 위치에 있는지 확인합니다. 최종 결과는 다음과 같이 보일 것이다 : 날짜 및 온도의 잘못 배치가 관련 될 것으로 보인다선형 무게 기반 레이아웃의 잘못 된 textviews
: 실제 장치에
동안이이 HTTP처럼 보이는 끝 글꼴 크기가 커질수록 더 많은 글꼴이 잘못 배치됩니다.
누구나 원인을 알아낼 수있는 정보가 있습니까?
내 코드 :
<?xml version="1.0"?>
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/all"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/monday"
android:includeFontPadding="false"
android:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:id="@+id/hwrap1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.70"
android:orientation="horizontal" >
<!-- wrapper for the first line (Time/day and namedays) -->
<LinearLayout
android:id="@+id/bloat1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.20"
android:orientation="horizontal" >
</LinearLayout>
<!-- empty space before day and time -->
<!-- wrapper around time and day -->
<TextView
android:id="@+id/dayOfWeek"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.90"
android:gravity="top|left"
android:text="PIRMDIENA"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="45dp" />
<LinearLayout
android:id="@+id/bloat2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.1"
android:orientation="horizontal" >
</LinearLayout>
<!-- empty space before namedays -->
<TextView
android:id="@+id/nameDays"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.9"
android:gravity="left|center"
android:text="Arnijs, Jorijs, Blobijs"
android:textColor="#041869"
android:textSize="60dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/hwrap2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.20"
android:orientation="horizontal" >
<!-- wrapper around second line (date and temp) -->
<LinearLayout
android:id="@+id/bloat3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.33"
android:orientation="horizontal" >
<!-- space before date -->
</LinearLayout>
<TextView
android:id="@+id/date"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3.65"
android:gravity="left|center"
android:text="DATE"
android:textAllCaps="true"
android:textColor="#FFFFFF"
android:textSize="80dp" />
<TextView
android:id="@+id/temperature"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.1"
android:gravity="center"
android:text="14c"
android:textColor="#FFFFFF"
android:textSize="80dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/hwrap3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3.9"
android:orientation="horizontal" >
<!-- wrapper around message (3rd line) -->
<LinearLayout
android:id="@+id/bloat4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="horizontal" >
<!-- space before message -->
</LinearLayout>
<TextView
android:id="@+id/msg"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="6"
android:gravity="center|left"
android:text="Deep text about life... much sense such fullfillment wow"
android:textColor="#FFFFFF"
android:textSize="45dp" />
<LinearLayout
android:id="@+id/bloat5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:orientation="horizontal" >
<!-- space after message -->
</LinearLayout>
</LinearLayout>
</LinearLayout>