android,线性布局内的ImageView don';不适合屏幕大小

android,线性布局内的ImageView don';不适合屏幕大小,android,layout,fullscreen,Android,Layout,Fullscreen,我想知道如何使我的线性布局中的四个图像看起来尽可能大,取决于屏幕。当我在手机中安装小部件时,它总是只适合屏幕的50%。 这里是xml。 有什么提示吗 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_hei

我想知道如何使我的线性布局中的四个图像看起来尽可能大,取决于屏幕。当我在手机中安装小部件时,它总是只适合屏幕的50%。 这里是xml。 有什么提示吗

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical|clip_horizontal"
android:orientation="horizontal" >

<ImageView
    android:id="@+id/hora1_current"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    android:scaleType="fitCenter"
    android:src="@drawable/neutro_on" />

<ImageView
    android:id="@+id/hora2_current"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    android:scaleType="fitCenter"
    android:src="@drawable/neutro_on" />

<ImageView
    android:id="@+id/minuto1_current"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    android:scaleType="fitCenter"
    android:src="@drawable/neutro_on" />

<ImageView
    android:id="@+id/minuto2_current"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    android:scaleType="fitCenter"
    android:src="@drawable/neutro_on" />


希望您阅读足够多关于垂直和水平方向的内容

在这里,您应该清楚,通过填充屏幕,您的意思是全部4个填充屏幕,每个填充25%,或者每个填充100%宽度,垂直相加

  • 对于第一种情况,为每个imageView添加
    android:layout_weight=1
  • 对于第二种情况,将根LinerLayout中的android:orientation=“horizontal”替换为

  • 将android:weightSum=“1”添加到父线性布局中。 线性布局应有
    android:orientation=“horizontal”
    现在,在每个图像视图中添加
    android:layout\u weight=0.25


    希望如此。

    不要使用换行内容,而是使用图像的实际尺寸或填充父对象。

    您希望您的图像填充屏幕宽度吗?是的,我希望它们填充屏幕。关于width=“wrap\u content”而不是明显的“fill\u parent”:如果我这样做,那么我只会获得屏幕中的第一张图像,其余的都不见了。你要怎么堆放?第一箱是我要找的。我要试试,提前谢谢。应用layout\u weight=1后,小部件仍然只占屏幕的50%:(我忘了添加…在您的图像视图中提到android:layout\u width=“0dip”