gpt4 book ai didi

java - "Binary XML file line #8: You must supply a layout_width attribute"虽然属性已经存在

转载 作者:行者123 更新时间:2023-11-29 03:27:49 26 4
gpt4 key购买 nike

我收到一个错误说明

 "Binary XML file line #8: You must supply a layout_width attribute."

但是我已经指定了布局宽度 (fill_parent),所以我真的不确定为什么会这样。我确定这是我忽略的简单问题 - 我只是不确定它到底是什么。

来源:


<?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="wrap_content"
android:orientation="vertical" >

<RelativeLayout>

<View
android:layout_width="1dp"
android:layout_height="5dp" >
</View>

<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >

<com.google.android.youtube.player.YouTubePlayerView
android:id="@+id/youtubeplayerview"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />

<View
android:layout_width="1dp"
android:layout_height="5dp" >
</View>

<TextView
android:id="@+id/textView1a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Isaac Daniel at CNN Anderson Cooper"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:id="@+id/textView2a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="by idconex"
android:textAppearance="?android:attr/textAppearanceSmall" />

<TextView
android:id="@+id/textView3a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="675,000,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />

<com.google.android.youtube.player.YouTubePlayerView
android:id="@+id/youtubeplayerview2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />

<TextView
android:id="@+id/textView1b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rage Against The Machine - Bulls on Parade"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:id="@+id/textView2b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="by RATMVEVO"
android:textAppearance="?android:attr/textAppearanceSmall" />

<TextView
android:id="@+id/textView3b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1,195,601 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
</ScrollView>
</RelativeLayout>

</LinearLayout>

最佳答案

您的 RelativeLayout 没有宽度和高度。试试这个:

<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">

关于java - "Binary XML file line #8: You must supply a layout_width attribute"虽然属性已经存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20080636/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com