Android的布局:;的TextView /&GT这个标签及其子可以通过一个实施更换;的化合物和可拉伸 [英] android layout: This tag and its children can be replaced by one <TextView/> and a compound drawable

查看:107
本文介绍了Android的布局:;的TextView /&GT这个标签及其子可以通过一个实施更换;的化合物和可拉伸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在一个特定的XML文件中运行的布局,我得到这样的:

When I run layout on a specific XML file, I get this:

 This tag and its children can be replaced by one <TextView/> 
and a compound drawable

什么变化应为下面的XML code来完成:

What change should be done for the following xml code:

<LinearLayout android:id="@+id/name_layout"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:background="@drawable/grouplist_single_left_grey_area" >
                <ImageView android:id="@+id/photo_image"
                    android:layout_width="@dimen/thumbnail_width"
                    android:layout_height="@dimen/thumbnail_height"
                    android:paddingBottom="5dip"
                    android:paddingTop="5dip"
                    android:paddingRight="5dip"
                    android:paddingLeft="5dip"
                    android:layout_marginRight="5dip"
                    android:clickable="true"
                    android:focusable="true"
                    android:scaleType="fitCenter"
                    android:src="@*android:drawable/nopicture_thumbnail"
                    android:background="@drawable/photo_highlight" />
                <TextView android:id="@+id/name"
                    android:paddingLeft="5dip"
                    android:layout_weight="1"
                    android:layout_width="0dip"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:textAppearance="?android:attr/textAppearanceLarge" />
            </LinearLayout>

这是怎么看起来像在屏幕上:

This is how it looks like on the screen:

摄像机图标是默认的。点击这将带给用户一个选项,选择另一个图像。

The camera icon is the default. Clicking on that will give the user an option to choose another image.

推荐答案

合并的TextView 的ImageView 成之一,通过使用TextView中的 setCompoundDrawable *()的方法,或者使用机器人:drawableLeft

Merge the TextView and the ImageView into one, by using TextView's setCompoundDrawable*() methods, or using android:drawableLeft.

这篇关于Android的布局:;的TextView /&GT这个标签及其子可以通过一个实施更换;的化合物和可拉伸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆