错误:未找到属性“textAlignment”封装“Android的资源标识符 [英] error: No resource identifier found for attribute 'textAlignment' in package 'android'
本文介绍了错误:未找到属性“textAlignment”封装“Android的资源标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的RES /布局mobile.xml文件。哪里是我的错?当我运行的TextView有此错误。
< XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:填充=5DP>
< ImageView的
机器人:ID =@ + ID / grid_item_image
机器人:layout_width =100dp
机器人:layout_height =118dp
机器人:SRC =@可绘制/ android_logo>
< / ImageView的>
<的TextView
机器人:ID =@ + ID / grid_item_label
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginTop =15dp
机器人:文本=@ + /标记
机器人:TEXTSIZE =25dp
机器人:textAlignment =中心>
< / TextView的>
< / LinearLayout中>
解决方案
textAlignment
中添加了API级17(安卓4.2)。
您模拟器/设备将需要运行4.2+为此工作。
否则,只需要使用安卓重力=中心
<的TextView
机器人:ID =@ + ID / grid_item_label
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginTop =15dp
机器人:文本=@ + /标记
机器人:TEXTSIZE =25dp
机器人:重力=中心/>
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" />
这篇关于错误:未找到属性“textAlignment”封装“Android的资源标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文