私は本当にアンドロイドの初心者です。いくつかのテキストビュー、画像を使用してレイアウトを作成したいだけです。
私はそれを作りました、そしてそれは私の編集者によく見えます。(私はeclipse / adtを使用しています)。
私が最初にそれを試したとき、結果はひどいものでした(写真を参照)。その後、私は別の設定でそれを試しましたが、それでも恐ろしいことです。
私が知っているように、dpは独立性のためのものですが、私が見るようにそうではありません。しかし、私は何か間違ったことをしたと思います。
私を助けて、教えてください、私は何を間違えますか、そしてなぜテキストビューと画像が動くのですか?
左から右への写真:
- 編集者
- Eclair、3.3 QVGA 320x480 mdpi
- ジェリービーンズ3.2WQVGA240x400 ldpi
そして私のコード:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/quizLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/quiz_background"
tools:context=".Quiz" >
<Button
android:id="@+id/btnGo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="36dp"
android:text="@string/go" />
<TextView
android:id="@+id/tvQuestion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="19dp"
android:layout_marginTop="60dp"
android:text="@string/question" />
<TextView
android:id="@+id/tvPoints"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/tvQuestion"
android:layout_below="@+id/tvQuestion"
android:layout_marginTop="31dp"
android:text="@string/points" />
<ImageView
android:id="@+id/imgCarHolder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/tvPoints"
android:layout_below="@+id/tvPoints"
android:layout_marginTop="26dp"
android:contentDescription="@string/dummy" />
</RelativeLayout>