如何设置TextView的左侧背景
答
您可以尝试自定义Drawable
背景。它会更容易些,不过,只为您的线路View
:
<View android:layout_width="2dip" android:layout_height="wrap_content" />
,然后将其定位到TextView
的左边,无论是通过LinearLayout
或RelativeLayout
。
谢谢。我的TextView已经在一个TableRow中,这将是'scretched column'。所以我不能在我的TextView的左边添加一个视图。如何在背景左侧创建带有图像的可绘制背景? – michael 2010-04-20 05:54:16
“所以我无法在我的TextView的左侧添加视图。”你当然可以。只需将'TextView'和'View'包装在'LinearLayout'中,并将其作为拉伸列的内容。 “我如何用背景左侧的图像创建一个Drawable背景?”您可以为此设置一个九个补丁的PNG:http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch – CommonsWare 2010-04-20 10:47:56