gpt4 book ai didi

安卓 : Set scroll view position to start at 80% from top of screen

转载 作者:搜寻专家 更新时间:2023-11-01 08:02:37 25 4
gpt4 key购买 nike

我正在努力实现这样的目标:

 -  |-------------------|<-------Phone screen
| ||-----------------||
| || ||
80% || ||
| || ||
| || |<--------Image View (fills screen, background)
- |||---------------|||
| ||| |||
20% ||| |<---------Scroll View (starts after 80% of parent view)
| ||-----------------||
- |-------------------|

ImageView 有一个填充背景的图像,scrollView 在 80% 高度后开始。有人可以帮助我了解如何针对所有设备尺寸实现这一目标吗?

最佳答案

使用layout_weight

<RelativeLayout 
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="8" />

<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2">

</ScrollView>

</LinearLayout>

</RelativeLayout>

关于安卓 : Set scroll view position to start at 80% from top of screen,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18942964/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com