Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: No resource identifier found for attribute 'textAlignment' in package 'android'

Tags:

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>
like image 389
sugur Avatar asked Nov 24 '13 14:11

sugur


1 Answers

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" />
like image 121
Ken Wolf Avatar answered Sep 28 '22 01:09

Ken Wolf