小编Baa*_*ali的帖子

Firebase 数据库实例如何实时检索数据?

我刚刚构建了我的第一个应用程序。这是一个群组消息应用程序,我使用了 Firebase 实时数据库。我按照教程构建了我的应用程序。

聊天工作完美且实时,即数据库中的任何更改都会在几秒钟内检索并反映在我的应用程序上。实际上,有点好奇,我不只是复制粘贴所有这些代码行,而是试图理解每个语句背后的含义。所以,我对我的疑问之一感到困惑:

这是如何实时工作的(聊天立即弹出)?我在这里阅读有关 Firebase 数据库的信息,他们提到ValueEventListener用于实时更新应用程序数据,但这里使用什么?

android chat firebase firebase-realtime-database

2
推荐指数
1
解决办法
3345
查看次数

在ScrollView / LinearLayout的底部放置一个视图

我刚开始使用Android,并且正在开发我的第一个包含登录屏幕的应用程序。

最初,我曾经使用RelativeLayoutAdView或者其他任何View 都已使用正确放置在父视图的底部android:layout_alignParentBottom="true"

然后,在阅读有关材料指南时,我指的是LinearLayout在内部使用的XML ScrollView。现在,我无法将自己AdView放在最底端(尝试将XML导入到Android Studio中)。在这里搜索答案,我也将其放在里面RelativeLayoutandroid:layout_alignParentBottom="true"再次使用,但没有成功。我知道Android用户已经使用了所有这些功能,希望他们能为我提供帮助。

因此,列出我的基本问题为:

  • 您能告诉我OP ScrollView在登录屏幕活动中的实际用途吗?如果您知道如何处理活动的UI,是否可以在任何提示中张贴两行或更多行,以提示我应该使用什么?任何提示将不胜感激。
  • 主要问题-那么,如何定位AdView到最底部?一个解释将不胜感激。

谢谢。:)

   <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="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"
    android:background="#FFB74D">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingTop="15dp"
        android:paddingLeft="24dp"
        android:paddingRight="24dp"
        android:backgroundTintMode="src_atop">

        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.5"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:gravity="center"
                android:text="Gyaanify"
                android:textSize="55sp"
                android:textColor="#FF3D00"
                android:textStyle="normal|bold"
                android:textAllCaps="false"
                android:textAlignment="center"
                android:fontFamily="cursive"
                android:layout_margin="10dp" />

        </RelativeLayout>

        <!-- Email Label -->
        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp">
            <EditText android:id="@+id/etUserName"
                android:layout_width="match_parent" …
Run Code Online (Sandbox Code Playgroud)

user-interface android android-studio

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