【发布时间】:2018-07-12 09:14:29
【问题描述】:
activity_Main.xml
<android.support.design.widget.BottomNavigationView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_gravity="bottom"
android:background="@android:color/white"
app:elevation="8dp"
app:menu="@menu/menu_navigation" />
</android.support.design.widget.CoordinatorLayout>
content_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.efftronics.android.mobilecashflow.Activity.MainActivity"
tools:showIn="@layout/activity_main">
<FrameLayout
android:id="@+id/fragment_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" >
</FrameLayout>
</android.support.constraint.ConstraintLayout>
fragment_home.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:id="@+id/lin_fragment_home"
android:layout_height="match_parent">
<ExpandableListView
android:id="@+id/expandible_listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:groupIndicator="@null">
</ExpandableListView>
</android.support.constraint.ConstraintLayout>
在主要活动中,我设置了 activity_main.xml。在那个主布局中,我包含了 content_main.xml 在片段中,我需要设置 Expandablelistview。但它并没有设置为整个片段。它被设置为仅片段的中心。
请帮助我。我尝试了很多方法。但没有得到解决方案。
任何帮助将不胜感激。
谢谢。
【问题讨论】:
-
请告诉我需要更改哪个布局文件?@JaydeepPatel
-
在您的 fragment_frame 布局中,您可以尝试将宽度和高度都设置为 0dp 吗?而不是 wrap_content
标签: android android-layout expandablelistview android-coordinatorlayout android-constraintlayout