android– 为什么Eclipse会告诉我LinearLayout没有属性“margin”?

android– 为什么Eclipse会告诉我LinearLayout没有属性“margin”?,第1张

概述我尝试构建我的android项目时收到错误:Noresourceidentifierfoundforattribute‘margin’inpackage‘android’它引用这种布局作为罪魁祸首.但我发现它没有任何问题.任何想法为什么Eclipse会认为这些视图上没有保证金有利润?<?xmlversion="1.0"encoding="utf-8"?>

我尝试构建我的android项目时收到错误:

No resource IDentifIEr found for attribute ‘margin’ in package ‘androID’

它引用这种布局作为罪魁祸首.但我发现它没有任何问题.

任何想法为什么Eclipse会认为这些视图上没有保证金有利润?

<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="match_parent"    androID:layout_height="wrap_content"    androID:layout_margin="5dp"    androID:background="@color/Feedstory_background_color"    androID:margin="5dp"    androID:orIEntation="vertical"    androID:padding="5dp" >    <relativeLayout        androID:ID="@+ID/Feed_profile_bar"        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:layout_marginBottom="5dp" >        <Imagebutton            androID:ID="@+ID/Feed_profileImage"            androID:layout_wIDth="60dp"            androID:layout_height="60dp"            androID:layout_alignParentleft="true"            androID:layout_margin="0dp"            androID:background="@color/black_bg"            androID:maxHeight="60dp"            androID:maxWIDth="60dp"            androID:padding="1dp"            androID:scaleType="centerInsIDe"            androID:src="@drawable/Feed_blank_profile_picture" />        <linearLayout            androID:ID="@+ID/profile_texts"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_marginBottom="5dp"            androID:layout_marginleft="5dp"            androID:layout_toRightOf="@ID/Feed_profileImage"            androID:orIEntation="vertical" >            <TextVIEw                androID:ID="@+ID/profile_name_text"                                androID:layout_wIDth="match_parent"                androID:layout_height="wrap_content"                androID:text="@string/Feed_profile_name" >            </TextVIEw>            <TextVIEw                androID:ID="@+ID/profile_location_text"                                androID:layout_wIDth="match_parent"                androID:layout_height="wrap_content"                androID:text="@string/Feed_profile_location" >            </TextVIEw>            <TextVIEw                androID:ID="@+ID/profile_time_text"                                androID:layout_wIDth="match_parent"                androID:layout_height="wrap_content"                androID:text="@string/Feed_profile_time" >            </TextVIEw>        </linearLayout>        <linearLayout            androID:ID="@+ID/profile_texts"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_alignParentRight="true"            androID:orIEntation="vertical" >            <button                androID:ID="@+ID/fan_button"                                androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"                androID:layout_marginBottom="5dp"                androID:background="@drawable/red_button"                androID:margin="0dp"                androID:minHeight="0dip"                androID:minWIDth="70dip"                androID:padding="5dp"                androID:text="@string/Feed_fan_button" />            <TextVIEw                androID:ID="@+ID/fan_count_text"                                androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"                androID:background="@drawable/grey_button"                androID:margin="0dp"                androID:minHeight="0dip"                androID:minWIDth="70dip"                androID:padding="5dp"                androID:text="000000" >            </TextVIEw>        </linearLayout>    </relativeLayout>    <linearLayout        androID:ID="@+ID/content_container"        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:layout_marginBottom="5dp"        androID:orIEntation="vertical" >        <TextVIEw            androID:ID="@+ID/post_text"            androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:text="@string/Feed_default_post_text"                        >        </TextVIEw>    </linearLayout>    <relativeLayout        androID:ID="@+ID/Feedback_buttons"        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content" >        <button            androID:ID="@+ID/applaud_button"                        androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_marginRight="2dp"            androID:background="@drawable/red_button"            androID:minHeight="0dip"            androID:minWIDth="70dip"            androID:text="@string/Feed_applaud_button" />        <TextVIEw            androID:ID="@+ID/applaud_count_text"                        androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_alignParenttop="true"            androID:layout_marginleft="2dp"            androID:layout_toRightOf="@ID/applaud_button"            androID:background="@drawable/grey_button"            androID:margin="10dp"            androID:padding="10dp"            androID:text="000000" >        </TextVIEw>        <button            androID:ID="@+ID/comment_button"                        androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_alignParenttop="true"            androID:layout_marginRight="2dp"            androID:layout_toleftOf="@+ID/comment_count_text"            androID:background="@drawable/red_button"            androID:minHeight="0dip"            androID:text="@string/Feed_comment_button" />        <TextVIEw            androID:ID="@+ID/comment_count_text"                        androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_alignParentRight="true"            androID:layout_marginleft="2dp"            androID:layout_margintop="0dp"            androID:layout_weight="1"            androID:background="@drawable/grey_button"            androID:text="000000" >        </TextVIEw>    </relativeLayout></linearLayout>

解决方法:

在每个方向上声明5p边距的正确属性名称是:

androID:layout_margin="5dp"

请注意layout_前缀.你会想要删除说androID:margin =“5dp”的行,这就是让Eclipse抱怨的原因.

完整的有效保证金属性包括:

> layout_margin
> layout_marginBottom
> layout_marginEnd
> layout_marginleft
> layout_marginRight
> layout_marginStart
> layout_margintop

总结

以上是内存溢出为你收集整理的android – 为什么Eclipse会告诉我LinearLayout没有属性“margin”?全部内容,希望文章能够帮你解决android – 为什么Eclipse会告诉我LinearLayout没有属性“margin”?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1106751.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存