【问题标题】:getting error: No resource identifier found for attribute 'textAlignment' in package 'android'出现错误:在包“android”中找不到属性“textAlignment”的资源标识符
【发布时间】:2014-06-13 04:26:37
【问题描述】:

您好,我的 xml 中不断出现此错误:“错误:在包 'android' 中找不到属性 'textAlignment' 的资源标识符”

我已经尝试用谷歌搜索错误,但没有运气继承我的 xml 代码:

 <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#FFe5e5e5"
        android:orientation="vertical" >

    <!--     <EditText -->
    <!--         android:id="@+id/txtItem" -->
    <!--         android:layout_width="fill_parent" -->
    <!--         android:layout_height="wrap_content" -->
    <!--         android:inputType="text" > -->

    <!--         <requestFocus /> -->
    <!--     </EditText> -->

    <!--     <Button -->
    <!--         android:id="@+id/btnAdd" -->
    <!--         android:layout_width="fill_parent" -->
    <!--         android:layout_height="wrap_content" -->
    <!--         android:text="@string/add" /> -->

Error is flagging here: <TextView
            android:id="@+id/txtCurrentListName"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/reminder_bg"
            android:text="default"
            android:textColor="#FFffffff"
            android:textAlignment="gravity"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginTop="8dp"
            android:gravity="center"
            android:textSize="28sp"
             />

        <ListView
            android:id="@+id/listCurrentListItems"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >
        </ListView>

    </LinearLayout>

任何帮助都会很棒

提前感谢

问候

克里斯

【问题讨论】:

  • 你可以改用android:gravity

标签: android xml


【解决方案1】:

android:textAlignment was added in API Level 17。确保您的构建目标(例如,Eclipse 中的 Project > Properties > Android)设置为 17 或更高。

【讨论】:

  • 附加信息:对于旧平台,您可以使用 android:gravity 属性。有关更多信息,请参见此处:stackoverflow.com/a/20176191/2253407 从 API 级别 1 开始提供
猜你喜欢
  • 2013-12-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多