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

前端 未结 2 1687
误落风尘
误落风尘 2021-01-03 22:40

This is my res/layout mobile.xml file. Where is my mistake? When I run textview has this error.

    
    <         


        
相关标签:
2条回答
  • 2021-01-03 23:23

    I think what problem could be in this line:

    android:text="@+id/label"
    

    try this:

    android:text="@string/label"
    
    0 讨论(0)
  • 2021-01-03 23:25

    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" />
    
    0 讨论(0)
提交回复
热议问题