gpt4 book ai didi

java - XML 布局问题

转载 作者:行者123 更新时间:2023-12-01 18:54:50 25 4
gpt4 key购买 nike

我想扩展我的 XML 布局,因为我需要在一个屏幕上放置许多按钮。我在 TextView 和 ImageView 下添加了 ScrollView ,但似乎无法扩展布局?我的 ScrollView 上还收到 XML 错误布局:

error: Error parsing XML: mismatched tag

这是我的布局,显示了扩展问题。谁能告诉我我做错了什么?:

pic

这是我的 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="wrap_content"
android:orientation="vertical" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="84dp"
android:orientation="horizontal" >

<ImageView
android:id="@+id/imgLink"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="0.91"
android:src="@drawable/menulist" />

<TextView
android:id="@+id/textView1"
android:layout_width="165dp"
android:layout_height="match_parent"
android:layout_weight="0.14"
android:gravity="center"
android:text="Menu"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="40sp" />

</LinearLayout>

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<Button
android:id="@+id/btnAdd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:drawableLeft="@drawable/addconmenu"
android:src="@drawable/addconmenu"
android:text="Contacts List" />

<Button
android:id="@+id/btnView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:drawableLeft="@drawable/todo"
android:src="@drawable/todo"
android:text="&apos;To Do&apos; List" />

<Button
android:id="@+id/btnEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:drawableLeft="@drawable/musicmenu"
android:src="@drawable/musicmenu"
android:text="Music List" />

<Button
android:id="@+id/btnEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:drawableLeft="@drawable/shoppingmenu"
android:src="@drawable/shoppingmenu"
android:text="Shopping List" />

<Button
android:id="@+id/btnEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:drawableLeft="@drawable/gymmenu"
android:src="@drawable/gymmenu"
android:text="Gym List" />

<Button
android:id="@+id/btnEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:drawableLeft="@drawable/appointmentmenu"
android:src="@drawable/appointmentmenu"
android:text="Appointment List" />

</LinearLayout>

</LinearLayout>
</ScrollView>

最佳答案

看起来您应该颠倒布局最后两行的顺序。您将在关闭顶级 LinearLayout 标记后关闭 ScrollView 标记。

关于java - XML 布局问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14386278/

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