【发布时间】:2016-06-26 16:23:09
【问题描述】:
我在滚动视图中有一个布局,我在第一个布局的末尾添加了另一个布局。实际上,我正在尝试进行单页设计,其余的其他视图将在滚动后出现。我试图将 linearlayout1 和 linearlayout2 放到另一个视图中,但是没有用。我还设置了滚动视图 android:fillViewport="true" 但它使滚动视图变成了屏幕大小。
我已经添加了我想要的图像,但它也可以是一个视图,我的意思是 lin1 和 lin2 在一起。
我可以为一部手机设置宽度和高度,但我想为每个屏幕都这样做。例如像雅虎天气应用程序。他们为第一个视图做了一个布局,并从屏幕末尾开始另一个视图。我尝试了很多东西,但我无法想象如何放置布局。你能帮帮我吗?
感谢您的帮助
这就是我想要的
我试过了:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroller"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/linearlayout1"
android:background="@android:color/holo_purple"
android:layout_width="match_parent"
android:layout_height="350dp" >
<TextView
android:text="LinearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearlayout2"
android:background="@android:color/holo_blue_bright"
android:layout_width="match_parent"
android:layout_height="250dp"
android:orientation="vertical">
<TextView
android:text="LinearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:background="@android:color/holo_green_light"
android:layout_width="match_parent"
android:layout_height="350dp">
<TextView
android:text="LnearLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
但不幸的是,我无法为每个屏幕尺寸进行配置。
【问题讨论】:
-
请提供您的 xml。我猜你需要为你的滚动视图添加 match_parent 高度,但我不能确定没有 xml
-
我用 xml 编辑并添加了一张我无法想象的图像
标签: android layout alignment scrollview