Android ImageView和Textview

Android ImageView和Textview,android,layout,textview,imageview,Android,Layout,Textview,Imageview,我想创造像在图片一样的布局,但我一点也不知道如何制作这样的。。 有人能给我一个线索或替代方法吗?像这样拆分它。 水平线性布局中的图像视图和第一个文本视图。 然后这个线性布局是水平的,第二个文本视图是垂直的 一种方法是将文本视图放在上面,然后将图像视图覆盖在上面。我认为先定义TextView然后定义ImageView的RelativeLayout可能会起作用。您可以切换ImageView的可见性,但需要确保写入TextView的任何文本都是在考虑了ImageView的宽度后写入的,以便不遮挡任何文

我想创造像在图片一样的布局,但我一点也不知道如何制作这样的。。 有人能给我一个线索或替代方法吗?

像这样拆分它。 水平线性布局中的图像视图和第一个文本视图。 然后这个线性布局是水平的,第二个文本视图是垂直的


一种方法是将
文本视图
放在上面,然后将
图像视图
覆盖在上面。我认为先定义
TextView
然后定义
ImageView
RelativeLayout
可能会起作用。您可以切换
ImageView
的可见性,但需要确保写入
TextView
的任何文本都是在考虑了
ImageView
的宽度后写入的,以便不遮挡任何文本。

您可以尝试在相对布局中添加两个文本视图,并在该文本视图之外添加一个ImageView。 这可能会帮助您开始

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/item_generator"
    android:background="#FF000000">

    <TextView
        android:id="@+id/item_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="16dp"
        android:layout_marginTop="16dp"
        android:textColor="#FFF"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/item_title_val"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_alignParentRight="true"
        android:layout_marginRight="20dp"
        android:layout_marginTop="16dp"        
        android:textColor="@color/blue"
        android:textSize="16sp" />

    <TextView
        android:id="@+id/item_subtitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/item_title"
        android:layout_below="@+id/item_title"
        android:textColor="#888"
        android:textSize="14sp" />

    <ImageView
        android:id="@+id/item_right_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_marginTop="10dp"
        android:layout_marginRight="40dp"
        android:padding="0dp"
        android:contentDescription="@string/hello_world" />

</RelativeLayout>


使用框架布局,也可以使用相对布局。我以前考虑过这个解决方案,但是我从服务器上得到了长字符串。我如何将这些字符串分为两个文本视图,我不能按固定数字将这些字符串分开,因为每个设备上的字符串都不同