Reputation: 191
I can't see any tag to set width
Here I set textview height, if I set width it will not work properly.
<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" />
How can I set this in xml? Is it possible?
Upvotes: 19
Views: 9242
Reputation: 10472
try setting to android:width="50dip"
and see what you get. dip is device independent pixels. You should be able to see in eclipse in design view. You cannot just set to "300"
Upvotes: -2
Reputation: 2762
You can try something like:
<?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>
This way I think you would have more control of your image. Hope that helps.
Upvotes: 2