调整图像大小取决于Android的文字

时间:2014-03-26 12:19:19

标签: android

当我调整图像大小时,它最终取出屏幕底部的文本,我已经尝试调整图像大小来修复它,但它最终导致我不能在屏幕上同时显示这两个图像。

 <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"
            android:gravity="right">


        <TextView android:layout_column="10"
                  android:layout_row="0"
                  android:id="@+id/welcome_message"
                  android:layout_width="match_parent"
                  android:layout_height="128dp"
                  android:layout_marginLeft="0dp"
                  android:textAppearance="?android:attr/textAppearanceLarge"
                  android:gravity="center"
                  android:text='Welcome to the Coleraine Town app, swipe your finger from left to right to access the menu or simply tap the blue "C" at the top left corner.'
                  android:layout_gravity="center|bottom"
                  android:textColor="#348dff"/>
        <ImageView
                android:layout_width="match_parent"
                android:layout_height="201dp"
                android:id="@+id/home_image"
                android:src="@drawable/home_image"
                />

    </LinearLayout>

2 个答案:

答案 0 :(得分:0)

请为layout_weight

的每个孩子添加LinearLayout

答案 1 :(得分:0)

尝试这种布局

<LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"
        android:gravity="right">


    <TextView android:layout_column="10"
              android:layout_row="0"
              android:id="@+id/welcome_message"
              android:layout_width="wrap_content"
              android:layout_height="128dp"
              android:layout_marginLeft="0dp"
              android:textAppearance="?android:attr/textAppearanceLarge"
              android:gravity="center"
              android:text='Welcome to the Coleraine Town app, swipe your finger from left to right to access the menu or simply tap the blue "C" at the top left corner.'
              android:layout_gravity="center|bottom"
              android:textColor="#348dff"/>
    <ImageView
            android:layout_width="0dp"
            android:layout_height="201dp"
            android:id="@+id/home_image"
            android:src="@drawable/home_image"
            android:layout_weight="1"
            />

</LinearLayout>