小编M. *_*s.i的帖子

在协调器布局中定位视图

我正在尝试创建一个带有协调器布局的屏幕,其中包括:

  • 工具栏
  • Fragment,将使用导航API为每个页面替换
  • 底部应用栏

但是,我正在努力以某种方式定位视图,因此应用程序的底部栏不会与片段中的内容重叠。

请问你有没有机会帮我解决这个问题?据我所知,唯一的方法是在底部添加边距,但这在设备之间可能不一致。

举例来说,此列表共有 25 个项目,但最后两个项目与应用的底部栏重叠。

在此处输入图片说明

活动主线

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.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"
        tools:context=".MainActivity">

    <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/app_bar_layout"
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:theme="@style/AppTheme.AppBarOverlay"
            android:animateLayoutChanges="true"
            android:layout_above="@id/include">

        <androidx.appcompat.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"/>

        <com.google.android.material.tabs.TabLayout
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

            <com.google.android.material.tabs.TabItem
                    android:text="Test 1"
                    android:layout_height="match_parent"
                    android:layout_width="match_parent"/>

            <com.google.android.material.tabs.TabItem
                    android:text="Test 2"
                    android:layout_height="match_parent"
                    android:layout_width="match_parent"/>
        </com.google.android.material.tabs.TabLayout>

    </com.google.android.material.appbar.AppBarLayout>

    <include
            layout="@layout/content_main"
            android:id="@+id/include"/>

    <com.google.android.material.bottomappbar.BottomAppBar
            android:id="@+id/bar"
            android:layout_gravity="bottom"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

    <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/fab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_anchorGravity="right|top"
            app:layout_anchor="@+id/bar"
            android:src="@drawable/ic_add_black_24dp"/>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

内容主xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main"
tools:context=".MainActivity">

    <fragment
            android:layout_width="411dp" …
Run Code Online (Sandbox Code Playgroud)

layout android android-coordinatorlayout

8
推荐指数
2
解决办法
7213
查看次数

使用SQL Server数据库是否需要SQL Server Management Studio?

我在 Visual C# 中有一个项目,其中使用 SQL Server 数据库,在处理该项目时,我使用 SQL Server Management Studio 创建和管理“X”数据库。

现在我想在另一台PC上使用结果程序(带有数据库),当我搜索时,我发现我需要在目标PC上安装SSMS才能使用“X”数据库。

那么,有没有其他方法可以在不安装SSMS的情况下在其他PC上使用该程序和数据库,我想为该程序制作一个小型安装程序,可以由任何人在任何PC上安装。

感谢您的阅读。

sql-server ssms

5
推荐指数
1
解决办法
5934
查看次数