滚动型不是很好的RelativeLayout玩 [英] ScrollView not playing nicely with RelativeLayout

查看:158
本文介绍了滚动型不是很好的RelativeLayout玩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个滚动型在我的布局中最高级别的......我的滚动型中我有一个RelativeLayout的,其中包含其他视图。的问题是,RelativeLayout的不覆盖整个布局,因为它应该它在大约一半的屏幕切断。它的宽度是画面的全宽,但RelativeLayout的高度停止其中的ImageView的底部。这是我的布局code:

 <?XML版本=1.0编码=UTF-8&GT?;
<滚动型的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:方向=横向
机器人:背景=@绘制/ graybck>< RelativeLayout的
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:方向=横向>< ImageView的
    机器人:ID =@ + ID / pPicture
    机器人:layout_width =200dip
    机器人:layout_height =300dip
    机器人:layout_alignParentLeft =真
    机器人:layout_alignParentTop =真/><的TextView
    机器人:ID =@ + ID / PNAME
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_alignParentTop =真
    机器人:layout_marginTop =29dp
    机器人:layout_toRightOf =@ + ID / pPicture
    机器人:文字=大文本
    机器人:textAppearance =:/>中的Andr​​oid ATTR / textAppearanceLarge?<的TextView
    机器人:ID =@ + ID / PBIO
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_alignLeft =@ + ID / PNAME
    机器人:layout_below =@ + ID / PNAME
    机器人:layout_marginTop =22dp
    机器人:文字=中文字
    机器人:textAppearance =机器人:ATTR / textAppearanceMedium/><的TextView
    机器人:ID =@ + ID /统计
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_alignParentRight =真
    机器人:layout_alignTop =@ + ID / PNAME
    机器人:layout_marginRight =266dp
    机器人:文字=正在加载统计.../>< / RelativeLayout的>< /滚动型>

任何帮助很多AP preciated!


解决方案

 <&滚动视图GT;
    <&的LinearLayout GT;
        <&RelativeLayout的GT;
        这里内部...
        < / RelativeLayout的>
    < / LinearLayout中>
< /滚动型>

尝试使用类似的东西。

So I have a ScrollView as the highest-level in my layout...within my ScrollView I have a RelativeLayout which contains other views. The problem is that the RelativeLayout does not cover the entire layout as it should, It cuts off at about half the screen. It's width is the full width of the screen, but the height of the RelativeLayout stops where the bottom of the ImageView is. here is my layout code:

<?xml version="1.0" encoding="utf-8"?>    
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" 
android:background="@drawable/graybck">

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

<ImageView
    android:id="@+id/pPicture"
    android:layout_width="200dip"
    android:layout_height="300dip"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true" />

<TextView
    android:id="@+id/pName"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_marginTop="29dp"
    android:layout_toRightOf="@+id/pPicture"
    android:text="Large Text"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/pBio"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/pName"
    android:layout_below="@+id/pName"
    android:layout_marginTop="22dp"
    android:text="Medium Text"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
    android:id="@+id/stats"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignTop="@+id/pName"
    android:layout_marginRight="266dp"
    android:text="Loading Stats..." />

</RelativeLayout>

</ScrollView>

Any help is much appreciated!

解决方案

<Scrollview> 
    <LinearLayout>
        <RelativeLayout>
        inner part here ...
        </RelativeLayout>
    </LinearLayout>  
</Scrollview>

Try using something like that.

这篇关于滚动型不是很好的RelativeLayout玩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆