gpt4 book ai didi

java - 框架布局未显示在主要 Activity 中

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

这是我的activity_main.xml

<?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="match_parent"
android:orientation="horizontal">

<include android:id="@+id/toolbar"
layout="@layout/toolbar"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_below="@+id/toolbar">

<FrameLayout
android:id="@+id/fragment_content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>

</LinearLayout>


</LinearLayout>

我的toolbar.xml:

<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" />

我发送到fragment_content的 fragment :

<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"
android:orientation="vertical"
android:background="#ffffff">

<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_container"
android:layout_below="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- Listview -->
<ListView
android:id="@+id/lvEvent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:divider="#D0D0D0"
android:dividerHeight="0.5dp"
android:showDividers="middle"/>

</android.support.v4.widget.SwipeRefreshLayout>

</RelativeLayout>

现在工具栏出现了,我可以用它执行操作,但我的框架布局中没有任何内容?如果我删除包含(工具栏),那么我可以看到框架布局中的内容。有人知道我做错了什么吗?

最佳答案

鉴于您已将工具栏的高度设置为 wrap_content,我假设您想要垂直布局,但您的顶级 LinearLayout 设置为水平。将方向更改为垂直

关于java - 框架布局未显示在主要 Activity 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27040353/

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