我面临的一个问题,当涉及到我的应用程序(附件)的宽度。由于我使用的是操作栏,所以屏幕的整个宽度似乎没有被使用,并且“设置”菜单将显示的空间将占用屏幕的剩余宽度。有没有办法使用全宽,因为我还没有使用“设置”菜单?应用程序不使用屏幕(动作条)的全宽
app_bar_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.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>
<include layout="@layout/content_main" />
</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.example.simple.activities.MainActivity"
tools:showIn="@layout/app_bar_main">
<RelativeLayout
android:id="@+id/master_fragment"
android:layout_width="368dp"
android:layout_height="495dp"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp">
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
current_fragment.xml:
<FrameLayout 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"
tools:context="com.example.simple.fragments.Notifier">
<!-- TODO: Update blank fragment layout -->
<TabHost
android:id="@+id/tab_host"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include android:id="@+id/layout1"
layout="@layout/activity_hour_notification"
android:layout_width="match_parent"
android:layout_height="match_parent"></include>
<include android:id="@+id/layout2"
layout="@layout/activity_minute_notification"
android:layout_width="match_parent"
android:layout_height="match_parent"></include>
</FrameLayout>
</LinearLayout>
</TabHost>
</FrameLayout>
感谢在这一个任何帮助!
发表您的布局XML代码以获得更好的主意。 –
@abhilnair:已添加。让我知道是否有更多需要的信息。 – Araw
好的,让我问一下你在content_main.xml中的分段视图。因为content_main.xml中的相对布局是空白的,所以请证明。还有一件事是,你是否正确地在工具栏下获得布局,因为你没有在你的包含布局中指定,也没有在下面提到包含布局应该出现的“什么”。请张贴您的整个屏幕截图。 –