我看不到任何要设置宽度的标记
我在这里设置了文本视图的高度,如果我设置了宽度,它将不能正常工作。
<TextView
android:id="@+id/nome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:drawableLeft="@drawable/ic_launcher"
android:height="50dp" />
我如何在xml中设置它?有可能吗?
发布于 2012-08-09 07:31:14
您可以尝试执行以下操作:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/Home"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="Something"
android:textColor="#FFFFFF" />
<ImageView
android:src="@drawable/icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_toLeftOf="@id/Home"/>
</RelativeLayout>
通过这种方式,我认为你可以更好地控制自己的形象。希望这能有所帮助。
发布于 2012-08-09 07:23:54
尝试将其设置为android:width="50dip"
,看看会得到什么。dip是与设备无关的像素。您应该能够在设计视图中看到eclipse。你不能就这样设置为"300“
https://stackoverflow.com/questions/11874538
复制相似问题