小编 Ek*_*ps 的帖子

如果不适合,将视图移动到“下一行”

所以,想法是这样的:我有两个TextViews,第一个可以扩展它想要的任何东西,第二个总是 5 个字符(时间)。问题在于第一个TextView可以轻松地将第二个推出屏幕。

所以,我需要的是诸如 adjust 之类的东西LinearLayout,或者如果它不适合父级,它可能GridLayoutTextView在某种第二行上移动第二。

例如,您可以在 Viber 和 WhatsApp 中查看消息气泡。感谢您的任何建议。

更新 1

这是我现在拥有的 XML(仅消息部分)

              <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/messageBox"
                android:layout_gravity="center_vertical"
                android:gravity="center_vertical">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="14sp"
                    android:layout_gravity="center_vertical"
                    android:gravity="center_vertical"
                    android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
                    android:textColor="@color/black"
                    android:text='@{mess.message}'/>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="center_vertical|end"
                    android:gravity="center_vertical|end"
                    android:paddingLeft="8dp"
                    android:textSize="12sp"
                    android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"
                    android:text='@{Utils.parseMillsToHoursAndMins(mess.date)}'/>
            </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

更新 2

所以我将 layout_weight 添加到 first TextView,这有助于解决我的第一个问题,但现在我有了新的问题。这两个TextViews in LinearLayoutwhich is in another LinearLayoutwith another TextView。父级的LinearLayout宽度设置为 wrap_content,因此如果 topTextView大于 2 TextViews,它将导致子级 …

android android-layout

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

通过共享链接从 Google Drive 获取文件

我正在制作类似在线日记应用程序的东西,它将从谷歌驱动器(通过共享链接)下载一次“日记文件”,并在该文件发生变化时更新该文件。请,任何人都可以指点我一些指南如何做到这一点。我已经尝试从驱动器固定文件,但我真的不明白接下来要做什么..

android google-drive-api google-drive-android-api

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