java - 图像在框架布局中未正确显示

标签 java android android-layout imageview android-tablelayout

我在framelayout下使用imageview。我在 ImageView 中应用了背景图像,但图像无法完全覆盖屏幕。它出现在中心。我想完全覆盖屏幕...

我怎样才能实现它? 提前感谢:-)

xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.muhammad.maqalatlayout.jild_copy"
android:background="@color/Green">

<ImageView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@mipmap/brown_border1"
    android:layout_margin="0dp"
    android:layout_marginLeft="0dp"
    android:layout_marginTop="0dp"
    android:layout_marginRight="0dp"
    android:layout_marginBottom="0dp"
    android:layout_gravity="top|left|bottom|center_vertical|right"
    android:visibility="visible"
    android:adjustViewBounds="false"
    android:scaleType="fitStart"/>

My Current output is like this.

最佳答案

我相信您的体重秤无法正常工作,因为您正在设置 android:background 属性。试试这个:

<ImageView
    ...
    android:src="@mipmap/brown_border1"
    ... />

此外,最好将图像放在 /drawable/ 文件夹中。

关于java - 图像在框架布局中未正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38785573/

相关文章:

android - 如何使用 Xamarin 播放暂停音频

android - 输入文本后如何退出editText?

java - 用房间数据库填充微调器

java - 为什么使用通配符调用 Enum.valueOf() 时会出现绑定(bind)不匹配错误

java - 由于 keystore 文件导致 ssl 握手异常

java - 我不明白为什么我的可扩展 ListView 的 onChildClick 方法出现致命异常

java - 如何向Java静态ArrayList添加元素

android - 如何以编程方式从android中的像素计算dp

android - Samsung Galaxy S4,从相机拍摄时图像损坏

android - 在运行时通过主内存中包含的 XML 字符串更改 Activity 的布局