【问题标题】:Align dynamic Image and Text in Android在Android中对齐动态图像和文本
【发布时间】:2011-06-06 14:09:36
【问题描述】:

我有一个标题,其中包含文本:“Huidige Locatie”,在其下方我有一个国家/地区国旗的图像。

我在布局中声明了TextView和ImageView如下:

<LinearLayout
            android:id="@+id/locatiebalk"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:paddingTop="5sp"
            android:orientation="horizontal">
            <LinearLayout
                android:id="@+id/vlaggenlocatie"
                android:layout_width="105sp"
                android:layout_height="fill_parent"
                android:paddingLeft="14sp"
                android:orientation="vertical">
                <TextView
                    android:id="@+id/huidiglocatie"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="Huidige locatie"
                    android:textColor="#000000"
                    android:textSize="12sp"/>
                <ImageView
                    android:id="@+id/flag"
                    android:layout_width="fill_parent"
                    android:layout_height="46sp"
                    android:gravity="left"
                    android:src="@drawable/nl"/>
                </LinearLayout>

(我稍后正确关闭标签,只显示相关部分)

在 Eclipse 的图形布局中,它以正确的方式显示它:

但在模拟器和我的手机上显示如下:

最好的方法是什么?

【问题讨论】:

    标签: android layout alignment


    【解决方案1】:

    修复它。

    对于那些想知道的人:android:scaleType="fitStart" 完成了这项工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-12
      • 1970-01-01
      • 1970-01-01
      • 2011-10-02
      • 1970-01-01
      • 2019-05-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多