This is my res/layout mobile.xml file. Where is my mistake? When I run textview has this error.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp" >
<ImageView
android:id="@+id/grid_item_image"
android:layout_width="100dp"
android:layout_height="118dp"
android:src="@drawable/android_logo" >
</ImageView>
<TextView
android:id="@+id/grid_item_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@+id/label"
android:textSize="25dp"
android:textAlignment="center" >
</TextView>
</LinearLayout>
textAlignment
was added in API level 17 (Android 4.2).
Your emulator/device will need to be running 4.2+ for this to work.
Otherwise just use android:gravity="center"
<TextView
android:id="@+id/grid_item_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@+id/label"
android:textSize="25dp"
android:gravity="center" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With