Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android imageView in the Src and Background     - PostgreSQL 9.4.3 Installation and Configuration under CentOS 6.5 (Database)

- C ++ complex class of operator overloading (Programming)

- MySQL concat function is SQL injection (Linux)

- Ubuntu users install the video driver Nvidia Driver 334.21 (Linux)

- SQL Server 2008 database synchronization Notes (Database)

- Installation of Ubuntu Make under Ubuntu 15.10 (Linux)

- Linux password file security issues detailed usage (Linux)

- Ubuntu 14.10 / 14.04 / 12.04 How to install Kodi 14.0 RC3 (Linux)

- Standard and IO redirection (Linux)

- Linux, Apache Web site security settings (Linux)

- About Python default character set (Linux)

- Seven kinds of NIC binding mode Detail (Linux)

- C ++ copy constructor (Programming)

- Try debugfs restore the deleted files ext3 file system (Linux)

- Linux (Debian) install software, missing dynamic link libraries .so (Linux)

- CentOS 7.0 running Docker kernel error solution (Server)

- C ++ CBitmap, HBitmap, Bitmap difference and contact (Programming)

- How to install CentOS 7.x in OpenERP (Odoo) (Linux)

- How to use the command line ftp upload and download files (Linux)

- Java environment to build a number of issues (Linux)

 
         
  Android imageView in the Src and Background
     
  Add Date : 2018-11-21      
         
         
         
  ImageView property has two display images, respectively, what role is it?

src
background
If both attributes exist, the user will see the background of the src attribute set in. But at the same background background set there, only to be blocked by the src attribute in the back. Src tantamount foreground, background tantamount background.

How to use java code to dynamically change the value of these two properties?

// Src:
imageView.setImageDrawable (this.getResources () getDrawable ((R.drawable.ic_launcher)).);
// Background:
imageView.setBackgroundResource (Android.R.color.background_dark);
ImageView in the XML attributes src and background difference:

background will be based on ImageView components of a given length and width stretch, and it is stored in src original size is not stretched. src is the image content (foreground), bg is the background, it can be used simultaneously.

Also: scaleType only src act; bg transparency can be set, for example, can be used in the ImageView android: scaleType control picture zoom mode, the sample code is as follows:

android: src = "@ drawable / logo"
android: scaleType = "centerInside"
android: layout_width = "60dip"
android: layout_height = "60dip"
android: layout_centerVertical = "true" />
Description: centerInside represents scaled image so that image length (width) of less than equal to the corresponding dimension view.

Note: The picture for control of resources and not the background.

layout should be set: android: src = "@ drawable / logo"

Instead android: background = "@ drawable / logo"

Code settings should be: imgView.setImageResource (R.drawable *.);

Instead imgView.setBackgroundResource (R.drawable *.);
     
         
         
         
  More:      
 
- MySQL how to export files with the date format (Database)
- To configure parameter configuration and software installation and uninstallation under Linux (Linux)
- The Java Properties class action (Programming)
- CentOS 6.5 minimal installation and configuration VMware tools (Linux)
- GCC and gfortran write MEX program (Matlab2012a) under Ubuntu 14.04 (Programming)
- CentOS 6.6 installation certification system based on the ftp service (Server)
- CentOS 6.5 installation and deployment SVN 1.8.10 (Linux)
- awk Programming Model (Programming)
- Android memory optimization of the optimal load Bitmap (Linux)
- Wi-Fi hackers use to attack your seven methods (Linux)
- Linux System Getting Started Tutorial: How to Force Change your password at next logon Linux (Linux)
- ActiveMQ5.11.1 and JDK version matching relation (Linux)
- UNIX and class UNIX system security check notes (Linux)
- RedHat Linux 6.4 install Oracle 10g error (Database)
- Use Hexo quickly build and deploy a blog to Github (Server)
- Gitblit adopted Ticket collaborative development model (Linux)
- Installed in the desktop version of Ubuntu Unity Tweak Tool (Linux)
- Configuring Haproxy log support (syslog logging support) (Server)
- Redis Design and Implementation study notes (Database)
- Attic-- delete duplicate data backup program (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.