【发布时间】:2016-05-30 19:53:15
【问题描述】:
我有这个 Layout ,当我尝试将 Image (src="Image") 放入任何 ImageView 时,Image 扩展了 ImageView 边框并覆盖了整个屏幕,这是我的 Layout 的一部分
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:id="@+id/firstFrame"
android:layout_margin="@dimen/LayoutMargin"
android:elevation="6dp"
android:background="@color/frame1"
android:orientation="horizontal"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/imageView"
android:layout_gravity="left|center_vertical"
android:layout_weight=".5"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".5"
android:orientation="vertical"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:gravity="center"
android:scaleType="centerCrop"
/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:gravity="center"
android:scaleType="centerCrop"
/>
</LinearLayout>
</LinearLayout>
我希望图像位于 ImageView 边框内, 请问有什么解决办法吗?
【问题讨论】:
-
android:scaleType="fitCenter" 在每个图像视图中使用此行代码。它是在 imageview 中调整您的图像...
-
你没有正确使用权重。
-
它不起作用 ,,, 所有 ScalType 类型都不起作用
-
重量问题出在哪里,请告诉我
-
Wights 要求加权尺寸(只能是一个)为 0dp。
标签: android xml imageview android-linearlayout