【发布时间】:2016-05-02 03:08:14
【问题描述】:
我正在我的应用中实现一个列表视图。我正在尝试为 android 6.0 构建我的应用程序并选择了主题“DarkActionBar”。我现在在 activity_main.xml 中有这段代码。
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
android:fitsSystemWindows="true"
tools:context="com.mycompany.www.mynotes.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<ListView
android:id="@+id/android:list"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
</android.support.design.widget.CoordinatorLayout>
我刚刚在这段代码中添加了一个列表视图(替换了一个文本视图)。当我创建我的项目时,其余代码已经存在。
现在我正在列表视图中随机添加一些项目。 现在的问题是,最顶部的列表视图项位于工具栏后面,如下图所示。如何解决?我希望这个列表视图从工具栏下方开始。
【问题讨论】:
-
这个问题和Android Studio有什么关系? Android Studio 是用于 Android 开发的 IDE。您的问题与 IDE 无关。
标签: java android android-studio