我可以在 Activity 中使用包含布局来滚动视图吗?
Can I Use The INCLUDE LAYOUT To ScrollView In My Activity?
你好,我的 xml 布局有问题。我创建了另一个 xml 文件 share_app_scroll(ScrollView Layout)
并将其包含在我的 ShareApp.xml
.
中
问题是,我的 toolbar/action 栏没有出现。我所能看到的,是我创建的 scrollview layout
。是否可以包含 scrollView layout
?。这是我的代码。
<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:fitsSystemWindows="true"
tools:context=".activities.ShareAppActivity">
<!--Include ActionBar/Toolbar-->
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"
android:elevation="8dp"
android:minHeight="?attr/actionBarSize"
android:background="@color/colorPrimary">
</android.support.v7.widget.Toolbar>
<include
android:id="@+id/share_scrollview"
layout="@layout/share_extend_scrollview"
android:layout_height="match_parent"
android:layout_width="match_parent"/>
抱歉图片模糊。
提前谢谢你。
问题出在清单文件中。
检查 xml 的 java 文件在清单中是否有 android:theme="@style/AppTheme.NoActionBar"。删除无操作栏,它就会出现。如果您在设计视图期间谈论。 api 级别旁边是应用主题。将其更改为 .NoactionBar
以外的任何内容
您正在使用相对布局作为父布局,因此您必须将包含布局对齐到 toolbar.Like 这个
下面
<include
android:id="@+id/share_scrollview"
layout="@layout/share_extend_scrollview"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_below="@+id/toolbar"/>
你好,我的 xml 布局有问题。我创建了另一个 xml 文件 share_app_scroll(ScrollView Layout)
并将其包含在我的 ShareApp.xml
.
问题是,我的 toolbar/action 栏没有出现。我所能看到的,是我创建的 scrollview layout
。是否可以包含 scrollView layout
?。这是我的代码。
<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:fitsSystemWindows="true"
tools:context=".activities.ShareAppActivity">
<!--Include ActionBar/Toolbar-->
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"
android:elevation="8dp"
android:minHeight="?attr/actionBarSize"
android:background="@color/colorPrimary">
</android.support.v7.widget.Toolbar>
<include
android:id="@+id/share_scrollview"
layout="@layout/share_extend_scrollview"
android:layout_height="match_parent"
android:layout_width="match_parent"/>
抱歉图片模糊。 提前谢谢你。
问题出在清单文件中。 检查 xml 的 java 文件在清单中是否有 android:theme="@style/AppTheme.NoActionBar"。删除无操作栏,它就会出现。如果您在设计视图期间谈论。 api 级别旁边是应用主题。将其更改为 .NoactionBar
以外的任何内容您正在使用相对布局作为父布局,因此您必须将包含布局对齐到 toolbar.Like 这个
下面 <include
android:id="@+id/share_scrollview"
layout="@layout/share_extend_scrollview"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_below="@+id/toolbar"/>