[英]How to set android:layout_alignParentLeft attribute to imageview in code?
[英]Type error: No resource identifier found for attribute 'layout_alignparentleft' in package
嗨,我一直遇到這個錯誤,但沒有找到解決方案。我更改了Api級別,然后對構建目標進行了相同的操作。我不知道這里出了什么問題,請您幫忙。
android:minSdkVersion="14" android:targetSdkVersion="18"
list_item.xml文件
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<textview
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignparentleft="true"
android:layout_alignparenttop="true"
android:layout_marginleft="26dp"
android:layout_margintop="23dp"
android:text="Medium Text"
android:textappearance="?android:attr/textAppearanceMedium" >
</textview>
</relativelayout>
這是主要的xml文件
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Main" >
<listview
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignparentleft="true"
android:layout_alignparenttop="true" >
</listview>
</relativelayout>
我收到這些錯誤
error: No resource identifier found for attribute 'layout_alignparenttop' in package 'android'
error: No resource identifier found for attribute 'layout_alignparenttop' in package 'android'
error: No resource identifier found for attribute 'layout_margintop' in package 'android'
error: No resource identifier found for attribute 'layout_alignparentleft' in package 'android'
error: No resource identifier found for attribute 'textappearance' in package 'android' list_item.xml
error: No resource identifier found for attribute 'layout_alignparentleft' in package 'android' list_item.xml
只需在XML
<relativelayout>
。 它應該是<RelativeLayout>
看看相對布局
也可以將textview
改成TextView
並將listview
改成ListView
@Aldo Borrero的評論
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.