質問

3つのフォルダーに画像があります。解像度として描画可能/drawable-hdpi/mdpi/ldpi 600*600を解像度として)。

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

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/sipLabel"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  />
  <ImageView android:id="@+id/connected" android:src="@drawable/connected" android:layout_below="@id/sipLabel" 
  android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:layout_weight="0.35" android:gravity="center" 
         />
        </LinearLayout>

BRは何が問題になるのでしょうか?ご協力ありがとうございました。

役に立ちましたか?

解決

主な問題は、最初のタグです LinearLayout:

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/sipLabel"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  />

以来 layout_height に設定されています fill_parent このTextViewは、LinearLayoutを垂直に埋めており、画像の余地はありません。変更してみてください layout_heightwrap_content.

また、他のいくつかのこと:

  • あなたが使用しています android:layout_below="@id/sipLabel", 、しかし、これはRelativeLayoutでのみ機能します。したがって、この属性は静かに無視されています。
  • 何でも選択できますが layout_weight あなたが欲しい、 0.35 かなりarbitrary意的です。重量のLinearLayoutの唯一の子供なので、追加の垂直スペースをすべて受け取ります。
  • 含める必要はありません xmlns:android="http://schemas.android.com/apk/res/android" TextViewタグで。

他のヒント

おもう layout_below RelativeLayoutsにのみ適用されます。また、それ layout_weight="0.35" 強大な疑いがあるように見えます、私はそれがあなたがそれが意味すると思うことを意味するとは思わない。整数値が必要だと思います。

あなたから TextView の高さがあります fill-parent, 、 そしてその LinearLayout スクロールしていません(に入れられない限り ScrollView あなたは下部を見ることができません)、あなた TextView アクティビティの画面全体を取り上げ、 ImageView その下にいることは見えません。

どちらもできます

  • あなたの全体を置いてください LinearLayoutScrollView, 、そして下にスクロールしてあなたの画像を見てください、または
  • あなたの目標が画面の下部に画像を表示することであり、その上の場所全体がとらなければならない場合 TextView, 、その後、 `relativeLayoutが最良の選択肢です。

アップデート
作業 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/sipLabel" android:text="@string/loremipsum1"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_alignParentTop="true" />
    <ImageView android:id="@+id/connected" android:src="@drawable/connected"
        android:layout_width="wrap_content" android:layout_height="wrap_content" 
        android:layout_below="@id/sipLabel" android:layout_alignParentBottom="true" />
</RelativeLayout>
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top