如何在图像视图中并排设置textview

时间:2016-08-02 06:55:52

标签: android layout android-imageview textview

** How to achieve this view? I can able to show text on right side. how to show it right side and  below image view.**

**如何实现这一观点?我可以在右侧显示文字。如何在图像视图的右侧和下方显示它?它是TextView包含的描述。因此,文本可以是一行或10行。

请帮助!!! **

3 个答案:

答案 0 :(得分:1)

使用以下布局

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.6">

        <ImageView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="vertical">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="Hello" />

        </LinearLayout>
    </LinearLayout>
    <TextView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.4"/>
</LinearLayout>

答案 1 :(得分:0)

您可以使用:

editText.setCompoundDrawables(getResources().getDrawable(R.drawable.your_image), null, null, null);

Similar question

答案 2 :(得分:0)

WebView最适合这个..在web和文本中添加图像视图填充webview