[英]Android - make all RelativeLayouts like floating left and going automatically in new lines
I have this scenario :我有这种情况:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
.... >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView as label ... />
<TextView text content....
android:layout_toRightOf=label />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView as label ... />
<TextView text content....
android:layout_toRightOf=label />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView as label ... />
<TextView text content....
android:layout_toRightOf=label />
</RelativeLayout>
.
.
.
.
</LinearLayout>
And I wanted all those relativelayouts to position automatically each one next to the previous and going automatically at new line if mobile phone is vertical and going automatically in one line if mobile phone is horizontal... I tried with GridLayout but looks like is not so good because contents textviews have different lenght depends from informations I get... is there a way to solve that?而且我希望所有这些相对布局自动定位到上一个旁边,如果手机是垂直的,则自动换行,如果手机是水平的,则自动换行...我尝试使用 GridLayout,但看起来并非如此很好,因为内容文本视图有不同的长度取决于我得到的信息......有没有办法解决这个问题? Thanks!
谢谢! Cheers!
干杯!
Android framework doesn't have such option built-in, you could write it by own, but Google did that for you. Android框架没有内置这样的选项,你可以自己写,但谷歌为你做了。 check out flexbox-layout library
查看flexbox-layout库
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.