【问题标题】:How i set an imageview as background?我如何将图像视图设置为背景?
【发布时间】:2016-12-20 21:41:57
【问题描述】:

我是 android studio 的新手,真的不知道如何将 Imageview 设置为背景。

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
>

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:srcCompat="@android:drawable/arrow_up_float"
    android:id="@+id/imageViewFull" />

【问题讨论】:

标签: android background imageview


【解决方案1】:

您无需添加图像视图即可将图像设置为背景。您可以通过添加来做到这一点 android:background="@drawable/background_image" 到布局标签。

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
               xmlns:app="http://schemas.android.com/apk/res-auto"
               android:orientation="vertical"           
               android:layout_width="match_parent"
               android:layout_height="match_parent"
               android:weightSum="1"
       android:background="@drawable/background_image">

有关其他方法,请参阅此问题 Full screen background image in an activity

【讨论】:

  • 谢谢你帮了我很多
猜你喜欢
  • 1970-01-01
  • 2013-10-28
  • 1970-01-01
  • 2012-01-02
  • 2014-06-23
  • 2011-01-11
  • 1970-01-01
  • 2010-11-25
  • 1970-01-01
相关资源
最近更新 更多