的ImageView和TextView的浮动(左/右)的Andr​​oidTextView、ImageView、oid、Andr

2023-09-11 07:44:59 作者:自嗨宝@

我正在寻找一种方法来在我的ImageView我的文字位置(所以像CSS的float左/右)。

I am searching for a way to position my text around my imageview (so like the css float left/right).

我怎样才能做到这在Android中?我已经使用安卓layout_alignParentLeft =真正的(来定位我的ImageView左)和安卓layout_alignParentRight =真正的我的TextView但 TextView中说到旁边的ImageView和ImageView的下方不会继续时,我有很长的文字。

How can I do this in Android? I have used android:layout_alignParentLeft="true" (to position my imageview left) and android:layout_alignParentRight="true" for my textview but the textview comes next to the imageView and doesn't continue underneath the ImageView when I have a long text..

任何想法?

推荐答案

我有同样的问题,试图让对准一个RelativeLayout的左边一个ImageView的。我用的android:scaleType =fitStart得到它固定

I had the same problem trying to get a ImageView aligned to the left of a RelativeLayout. I used android:scaleType="fitStart" to get it fixed.

我的XML文件:

 <RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="horizontal"
      android:layout_height="fill_parent"
      android:layout_width="fill_parent"
      android:padding="10dp">
     <ImageView
         android:layout_height="50dp"
         android:id="@+id/country_icon"
         android:layout_alignParentLeft="true"
         android:layout_width="wrap_content"
         android:scaleType="fitStart" />          
</RelativeLayout>