ListView控件不占用整个屏幕 [英] ListView doesn't occupy whole screen

查看:134
本文介绍了ListView控件不占用整个屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了所有可能的选项,的android:背景的android:cacheColorHint @android:彩色/透明 @null ,但没有使用的隐藏在图片列表视图

I have tried all possible options for android:background and android:cacheColorHint with @android:color/transparent and @null but of no use to hide the listView in the picture.

我试图合并灰色背景(粉红色问号)与我的应用程序的白色的主题。

I am trying to merge the gray background(pink question marks) with the white theme of my app.

我的主题是正规 @android:风格/ Theme.Light.NoTitleBar

我的布局code是

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@android:color/transparent" >

    <LinearLayout
        android:id="@+id/header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="1" >

        <ImageView
            android:id="@+id/abcIcon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|center_horizontal"
            android:layout_weight="0.15"
            android:contentDescription="@string/abcIcon"
            android:scaleType="centerInside"
            android:src="@drawable/abc" />

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|center_horizontal"
            android:layout_weight="0.70"
            android:text="@string/app_name"
            android:textSize="@dimen/headertextsize" />

        <ImageView
            android:id="@+id/search"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|center_horizontal"
            android:layout_weight="0.15"
            android:contentDescription="@string/abcIcon"
            android:src="@drawable/search" />
    </LinearLayout>

    <RelativeLayout
        android:id="@+id/followupHeaderLayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/header"
        android:layout_gravity="center_horizontal" >

        <RelativeLayout
            android:id="@+id/followupHeaderRelativeLayout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp" >

            <ImageView
                android:id="@+id/leftArrow"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:contentDescription="@string/abcIcon"
                android:src="@drawable/leftarrow" />

            <TextView
                android:id="@+id/followupHeaderText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@id/leftArrow"
                android:text="@string/followup"
                android:textSize="@dimen/headertextsize" />
        </RelativeLayout>

        <TextView
            android:id="@+id/followupDescriptionText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/followupHeaderRelativeLayout"
            android:layout_centerInParent="true"
            android:padding="10dp"
            android:text="@string/followupdescription"
            android:textSize="@dimen/normaltextsize" />
    </RelativeLayout>

    <TextView
        android:id="@+id/listViewHeaderText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/followupHeaderLayout"
        android:layout_marginLeft="10dp"
        android:text="@string/typeofAppt"
        android:textSize="@dimen/normaltextsize" />

    <RelativeLayout
        android:id="@+id/declarationLayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="10dp" >

        <TextView
            android:id="@+id/widgetLabel"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:text="@string/declarationCompletion"
            android:textColor="@android:color/black"
            android:textSize="@dimen/normaltextsize" />

        <Button
            android:id="@+id/doneButton"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/widgetLabel"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="15dp"
            android:background="#436EEE"
            android:gravity="left"
            android:paddingBottom="10dp"
            android:paddingLeft="5dp"
            android:paddingTop="10dp"
            android:text="@string/doneWithFollowup"
            android:textColor="@android:color/white"
            android:textSize="@dimen/normaltextsize" />
    </RelativeLayout>

    <ListView
        android:id="@+id/listViewFollowup"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@id/declarationLayout"
        android:layout_below="@id/listViewHeaderText"
        android:background="@android:color/transparent"
        android:cacheColorHint="@null"
        android:choiceMode="singleChoice" />

</RelativeLayout>

任何提示?

推荐答案

我所知道的唯一的解决办法是,因为你需要和位置这个列表下填写剩下来创建宽度1DP和高度的按钮。

The only solution I know is to create a Button with width 1dp and height as you need and position this one under the list to fill out the rest.

我appologize提前为这个相当脏的建议 - 但正如你我一直运行到这样的问题,试图bottom_margins,填充,背景固定大小,...我还没有发现任何一种干净的解决方案

I appologize in advance for this rather "dirty" advice - but as you I keep running into this kind of problem, tried bottom_margins, paddings, fixed sizes of backgrounds,.. I have not found any kind of "clean" solution.

期待更好的工作建议,关于这个主题太: - )

Looking forward to better working suggestions on this topic too :-)

这篇关于ListView控件不占用整个屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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