图像不适合平板电脑的整个屏幕
Image is not fitting on whole screen for tablet
我想将背景设置为 LinearLayout ,我参考了 this. But still it lefts spaces to 4 sides. screen shot is
代码如下
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/background"
android:scaleType="fitXY" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<someviews></someviews>
</LinearLayout>
</FrameLayout>
如果有解决办法请给出。
- 使用
android:src
代替android:background
.
- 添加
android:adjustViewBounds="true"
Sets a drawable as the content of this ImageView.
终于
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/background"
android:scaleType="fitXY"
android:adjustViewBounds="true" />
<resources>
<dimen name="activity_horizontal_margin">0dp</dimen>
<dimen name="activity_vertical_margin">0dp</dimen>
</resources>
检查dimen.xml文件放置0dp水平和垂直边距
我想将背景设置为 LinearLayout ,我参考了 this. But still it lefts spaces to 4 sides. screen shot is
代码如下
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/background"
android:scaleType="fitXY" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<someviews></someviews>
</LinearLayout>
</FrameLayout>
如果有解决办法请给出。
- 使用
android:src
代替android:background
. - 添加
android:adjustViewBounds="true"
Sets a drawable as the content of this ImageView.
终于
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/background"
android:scaleType="fitXY"
android:adjustViewBounds="true" />
<resources>
<dimen name="activity_horizontal_margin">0dp</dimen>
<dimen name="activity_vertical_margin">0dp</dimen>
</resources>
检查dimen.xml文件放置0dp水平和垂直边距