match_parent并且未按预期填充-AndroidXML

match_parent并且未按预期填充-AndroidXML,第1张

概述我在listView中有一个YoutubeThumbnail/ImageView,我想填充/拉伸到屏幕边缘:<com.example.project.ui.widget.VideosListViewandroid:id="@+id/videosListView"android:adjustViewBounds="true"android:scaleType=&

我在ListVIEw中有一个Youtubethumbnail / ImageVIEw,我想填充/拉伸到屏幕边缘:

        <com.example.project.ui.Widget.VIDeosListVIEw            androID:ID="@+ID/vIDeosListVIEw"            androID:adjustVIEwBounds="true"            androID:scaleType="fitXY"            androID:layout_wIDth="match_parent"            androID:layout_height="match_parent" />        </linearLayout>

 <com.example.project.ui.Widget.UrlimageVIEw        androID:ID="@+ID/userVIDeoThumbImageVIEw"        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        androID:adjustVIEwBounds="true"        androID:background="@androID:color/black"        androID:scaleType="fitXY"        androID:clickable="false"        androID:contentDescription="YouTube vIDeo thumbnail"        androID:focusable="false"        androID:focusableIntouchMode="false"        androID:gravity="center"        androID:src="@drawable/ic_launcher" />

当前似乎没有这样做,并且在某些设备上,缩略图看起来很小.

HTC Butterfly的屏幕截图:

galaxy S2的屏幕截图:

我不确定自己做错了什么-任何输入都会受到赞赏.

home.xml:

<?xml version="1.0" enCoding="utf-8"?><androID.support.v4.Widget.DrawerLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:ID="@+ID/drawer_layout"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent" >    <linearLayout        androID:ID="@+ID/content_frame"        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        androID:orIEntation="vertical" >    </linearLayout>    <ListVIEw        androID:ID="@+ID/left_drawer"        androID:layout_wIDth="120dp"        androID:layout_height="match_parent"        androID:layout_gravity="start"        androID:background="@color/darkgrey"        androID:choiceMode="singleChoice"        androID:divIDer="@androID:color/transparent"        androID:divIDerHeight="0dp" />    <TextVIEw        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:layout_gravity="center_horizontal"        androID:autolink="web"        androID:textStyle="bold" />    <relativeLayout        androID:ID="@+ID/rl"        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"         androID:background="#AAFFFFFF" >        <linearLayout            androID:layout_wIDth="match_parent"            androID:layout_height="match_parent"             androID:orIEntation="vertical" >                 <com.example.project.ui.Widget.VIDeosListVIEw            androID:ID="@+ID/vIDeosListVIEw"            androID:adjustVIEwBounds="true"            androID:scaleType="fitXY"            androID:layout_wIDth="match_parent"            androID:layout_height="match_parent" />        </linearLayout>        <linearLayout            androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:layout_alignParentBottom="true"            androID:orIEntation="horizontal" >            <relativeLayout                androID:layout_wIDth="50dip"                androID:layout_height="50dip"                androID:layout_alignParentBottom="true" >                <Imagebutton                    androID:layout_wIDth="match_parent"                    androID:layout_height="match_parent"                    androID:layout_gravity="left"                    androID:background="@color/darkgrey"                    androID:scaleType="centerCrop"                    androID:src="@drawable/home_up_btn" />            </relativeLayout>            <relativeLayout                androID:ID="@+ID/footer"                androID:layout_wIDth="match_parent"                androID:layout_height="50dip"                androID:layout_alignParentBottom="true"                 >                <androID.support.v4.vIEw.VIEwPager                    androID:ID="@+ID/vIEw_pager"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="match_parent" />                <Imagebutton                    androID:layout_wIDth="30dip"                    androID:layout_height="30dip"                    androID:layout_alignParentleft="true"                    androID:layout_centerVertical="true"                    androID:layout_marginleft="15dp"                    androID:focusable="false"                    androID:src="@drawable/scroll_lt_arrow" />                <Imagebutton                    androID:layout_wIDth="30dip"                    androID:layout_height="30dip"                    androID:layout_alignParentRight="true"                    androID:layout_centerVertical="true"                    androID:layout_marginRight="15dp"                    androID:focusable="false"                    androID:src="@drawable/scroll_rt_arrow" />            </relativeLayout>        </linearLayout>    </relativeLayout></androID.support.v4.Widget.DrawerLayout>

List_item_user_vIDeo.xml:

<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:orIEntation="vertical" >         <com.example.project.ui.Widget.UrlimageVIEw        androID:ID="@+ID/userVIDeoThumbImageVIEw"        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        androID:adjustVIEwBounds="true"        androID:background="@androID:color/black"        androID:scaleType="fitXY"        androID:clickable="false"        androID:contentDescription="YouTube vIDeo thumbnail"        androID:focusable="false"        androID:focusableIntouchMode="false"        androID:gravity="center"        androID:src="@drawable/ic_launcher" />    <VIEw        androID:layout_wIDth="match_parent"        androID:layout_height="2dp"        androID:visibility="invisible" />    <relativeLayout        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:orIEntation="vertical" >        <TextVIEw            androID:ID="@+ID/userVIDeoTitleTextVIEw"            androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:paddingleft="5dip"            androID:text="VIDeo Title Not Found"            androID:textcolor="@androID:color/black"            androID:textSize="20sp" />        <button            androID:ID="@+ID/fav_up_btn1"            androID:layout_wIDth="27dp"            androID:layout_height="27dp"            androID:layout_alignParentRight="true"            androID:background="@drawable/fav_up_btn1"            androID:clickable="false"            androID:focusable="false"            androID:focusableIntouchMode="false"            androID:gravity="right"            androID:paddingRight="5dp"            androID:paddingtop="5dp" />    </relativeLayout>    <relativeLayout        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:orIEntation="horizontal" >        <TextVIEw            androID:ID="@+ID/userVIDeouploaderTextVIEw"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:paddingleft="5dip"            androID:textcolor="@color/verylightgrey"            androID:textSize="16sp" />        <TextVIEw            androID:ID="@+ID/userVIDeovIEwsTextVIEw"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_toRightOf="@ID/userVIDeouploaderTextVIEw"            androID:textcolor="@androID:color/black"            androID:textSize="16sp" />    </relativeLayout></linearLayout>

JAVA:

private VIDeosListVIEw ListVIEw;ListVIEw = (VIDeosListVIEw) findVIEwByID(R.ID.vIDeosListVIEw);        ListVIEw.setonVIDeoClickListener(this);            private voID populateListWithVIDeos(Message msg) {        library lib = (library) msg.getData().get(                GetYouTubeUserVIDeosTask.liBRARY);        ListVIEw.setVIDeos(lib.getVIDeos());    }

编辑:

<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent"    androID:orIEntation="vertical" >    <com.IDg.omv.ui.Widget.UrlimageVIEw        androID:ID="@+ID/userVIDeoThumbImageVIEw"        androID:layout_wIDth="fill_parent"        androID:layout_height="fill_parent"        androID:adjustVIEwBounds="false"        androID:background="@androID:color/black"        androID:clickable="false"        androID:contentDescription="YouTube vIDeo thumbnail"        androID:focusable="false"        androID:focusableIntouchMode="false"        androID:scaleType="fitXY"        androID:src="@drawable/ic_launcher" />    <VIEw        androID:layout_wIDth="match_parent"        androID:layout_height="2dp"        androID:visibility="invisible" />    <relativeLayout        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:orIEntation="vertical" >        <TextVIEw            androID:ID="@+ID/userVIDeoTitleTextVIEw"            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"            androID:paddingleft="5dip"            androID:text="VIDeo Title Not Found"            androID:textcolor="@androID:color/black"            androID:textSize="20sp" />        <button            androID:ID="@+ID/fav_up_btn1"            androID:layout_wIDth="27dp"            androID:layout_height="27dp"            androID:layout_alignParentRight="true"            androID:background="@drawable/fav_up_btn1"            androID:clickable="false"            androID:focusable="false"            androID:focusableIntouchMode="false"            androID:gravity="right"            androID:paddingRight="5dp"            androID:paddingtop="5dp" />    </relativeLayout>    <relativeLayout        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:orIEntation="horizontal" >        <TextVIEw            androID:ID="@+ID/userVIDeouploaderTextVIEw"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:paddingleft="5dip"            androID:textcolor="@color/verylightgrey"            androID:textSize="16sp" />        <TextVIEw            androID:ID="@+ID/userVIDeovIEwsTextVIEw"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_toRightOf="@ID/userVIDeouploaderTextVIEw"            androID:textcolor="@androID:color/black"            androID:textSize="16sp" />    </relativeLayout></linearLayout>

编辑后的截图:

解决方法:

如果要扩展ImageVIEw,请尝试应用此方法:

androID:scaleType="fitXY"

或在Javacode中

imageVIEw.setScaleType(ScaleType.FIT_XY);

2)应用上述代码,例如:

<com.example.project.ui.Widget.UrlimageVIEw        androID:ID="@+ID/userVIDeoThumbImageVIEw"        androID:layout_wIDth="fill_parent"        androID:layout_height="fill_parent"        androID:adjustVIEwBounds="false"        androID:background="@androID:color/black"        androID:clickable="false"        androID:contentDescription="YouTube vIDeo thumbnail"        androID:focusable="false"        androID:scaleType="fitXY"        androID:focusableIntouchMode="false"        androID:gravity="center"        androID:src="@drawable/ic_launcher" />

编辑已更改:

androID:adjustVIEwBounds="true"

androID:adjustVIEwBounds="false"
总结

以上是内存溢出为你收集整理的match_parent并且未按预期填充-Android / XML全部内容,希望文章能够帮你解决match_parent并且未按预期填充-Android / XML所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1077486.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存