我正在开发Android智能手表应用程序。初始屏幕显示正常。但是,当我进入下一个屏幕时,上半部分弹出的项目名称就像这样。在下图中,Watch是项目的名称。
我希望看到整个屏幕而不是包含项目名称的空白区域。有谁知道如何解决它,为什么会出现?
我的XML文件是
<?xml version="1.0" encoding="utf-8"?>
<android.support.wear.widget.BoxInsetLayout 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"
tools:deviceIds="wear">
<LinearLayout
android:id="@+id/mainContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/black"
android:weightSum="1"
tools:ignore="UselessParent"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
<LinearLayout
android:id="@+id/sign_up_top_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:layout_marginTop="15dp">
<TextView
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="5dp"
android:textAlignment="center"
android:textSize="18sp"
android:text="@string/text"
android:background="@color/black"
android:textColor="@color/white"
android:fontFamily="Century-Gothic.ttf" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="18dp"
android:layout_height="19dp"
android:layout_toRightOf="@+id/text"
android:src="@drawable/fingerprint" />
</LinearLayout>
<Button
android:layout_marginTop="10dp"
android:id="@+id/button"
android:background ="@drawable/roundedbutton"
android:text="@string/button_text"
android:layout_width="108dp"
android:textAlignment="center"
android:drawablePadding="20dp"
android:layout_gravity="center"
android:textColor="@color/white"
android:layout_height="75dp"
android:layout_weight="0.34" />
</LinearLayout>
</android.support.wear.widget.BoxInsetLayout>
答案 0 :(得分:1)
使用BoxInsetLayout作为根布局:
此类根据屏幕应用所需的窗口insets 形状,让您轻松对齐中心或边缘附近的视图 屏幕。
我强烈建议您阅读本教程。
编辑2:
您需要使用:
[
{
"display_weekday": "Tuesday",
"display_date": "2017-08-01",
"starts_at_date": "2017-08-01",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-01 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Wednesday",
"display_date": "2017-08-02",
"starts_at_date": "2017-08-02",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-02 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Thursday",
"display_date": "2017-08-03",
"starts_at_date": "2017-08-03",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-03 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Friday",
"display_date": "2017-08-04",
"starts_at_date": "2017-08-04",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-04 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Saturday",
"display_date": "2017-08-05",
"starts_at_date": "2017-08-05",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-05 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Sunday",
"display_date": "2017-08-06",
"starts_at_date": "2017-08-06",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-06 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Monday",
"display_date": "2017-08-07",
"starts_at_date": "2017-08-07",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-07 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Tuesday",
"display_date": "2017-08-08",
"starts_at_date": "2017-08-08",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-08 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Wednesday",
"display_date": "2017-08-09",
"starts_at_date": "2017-08-09",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-09 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Thursday",
"display_date": "2017-08-10",
"starts_at_date": "2017-08-10",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-10 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Friday",
"display_date": "2017-08-11",
"starts_at_date": "2017-08-11",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-11 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Saturday",
"display_date": "2017-08-12",
"starts_at_date": "2017-08-12",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-12 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Sunday",
"display_date": "2017-08-13",
"starts_at_date": "2017-08-13",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-13 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Monday",
"display_date": "2017-08-14",
"starts_at_date": "2017-08-14",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-14 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Tuesday",
"display_date": "2017-08-15",
"starts_at_date": "2017-08-15",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-15 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Wednesday",
"display_date": "2017-08-16",
"starts_at_date": "2017-08-16",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-16 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Thursday",
"display_date": "2017-08-17",
"starts_at_date": "2017-08-17",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-17 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Friday",
"display_date": "2017-08-18",
"starts_at_date": "2017-08-18",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-18 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Saturday",
"display_date": "2017-08-19",
"starts_at_date": "2017-08-19",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-19 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Sunday",
"display_date": "2017-08-20",
"starts_at_date": "2017-08-20",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-20 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Monday",
"display_date": "2017-08-21",
"starts_at_date": "2017-08-21",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-21 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Tuesday",
"display_date": "2017-08-22",
"starts_at_date": "2017-08-22",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-22 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Wednesday",
"display_date": "2017-08-23",
"starts_at_date": "2017-08-23",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-23 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Thursday",
"display_date": "2017-08-24",
"starts_at_date": "2017-08-24",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-24 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Friday",
"display_date": "2017-08-25",
"starts_at_date": "2017-08-25",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-25 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Saturday",
"display_date": "2017-08-26",
"starts_at_date": "2017-08-26",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-26 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Sunday",
"display_date": "2017-08-27",
"starts_at_date": "2017-08-27",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-27 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Monday",
"display_date": "2017-08-28",
"starts_at_date": "2017-08-28",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-28 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Tuesday",
"display_date": "2017-08-29",
"starts_at_date": "2017-08-29",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-29 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Wednesday",
"display_date": "2017-08-30",
"starts_at_date": "2017-08-30",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-30 17:00",
"ends_at_time": "17:00"
},
{
"display_weekday": "Thursday",
"display_date": "2017-08-31",
"starts_at_date": "2017-08-31",
"starts_at_time": "07:00",
"ends_at_date": "2017-08-31 17:00",
"ends_at_time": "17:00"
}
]
不
android.support.wearable.view.BoxInsetLayout
并添加到mainContainer:
android.support.wear.widget.BoxInsetLayout
app:layout_box="all"
答案 1 :(得分:1)
问题的答案很简单。一天后我发现了。我将主题从 Theme.AppCompat.Light 更改为Manifest文件中的 Theme.AppCompat.Light.NoActionBar 。程序名称栏消失了。