如何将屏幕高度设置为xml高度值?

时间:2019-09-11 17:02:51

标签: java android

我需要有5行滚动视图,然后再滚动5行。 有没有一种方法可以计算屏幕高度并将其作为android:layout_height属性提供给xml? 因此我可以将screenheight / 5作为滚动视图中每个布局的高度。

到目前为止,我有这个:

   <ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:layout_editor_absoluteX="96dp"
    tools:layout_editor_absoluteY="137dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
      <Image here.. >
      <Image here.. >
      <Image here.. >
      <Image here.. >
      <Image here.. >
    </LinearLayout>
</ScrollView>

所以我需要显示5张图像,然后再滚动5张。 任何想法 ?我刚刚开始学习android,所以对不起,

0 个答案:

没有答案