Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android imageView in the Src and Background     - Standard and IO redirection (Linux)

- Nginx + Tomcat static and dynamic load balancing and separation configuration essentials under Linux (Server)

- ORA-04031 Error Resolution (Database)

- Ubuntu install Tonido private cloud services (Server)

- How to use SVN to manage our source code (Server)

- Oracle TAF Analysis (Database)

- Using C / C ++ extensions Python (Programming)

- HAProxy performance under high concurrency (Server)

- Acting on JavaScript events (Programming)

- FastDFS installation and deployment (Server)

- iptables using summary (Linux)

- Java in the final qualifier (Programming)

- When Vim create Python scripts, vim autocomplete interpreter and encoding method (Programming)

- Linux initialization init system - UpStart (Linux)

- JavaScript in this usage (Programming)

- Ubuntu Apache2 setting, problem solving css, pictures, etc. can not be displayed (Server)

- Linux NIC driver and version information (Linux)

- Oracle 11g can not export a variety of empty table solution (Database)

- How a lot of blocking malicious IP address in Linux (Linux)

- Close common port to protect server security (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:      
 
- CentOS 6.4 install and configure Squid Proxy Server (Linux)
- Elaborate .NET Multithreading: Concepts (Programming)
- Computer security perimeter recommendations (Linux)
- SVN hook code set to synchronize Web directory (Server)
- How dependent on Fedora, CentOS, RHEL check RPM packages (Linux)
- Make Windows boot disk to install USB in Ubuntu Linux (Linux)
- Java Learning: elegant string (Programming)
- MySQL restart process can not be taken lightly (Database)
- To establish a secure and reliable Linux operating system (Linux)
- Ubuntu: HDF5 error: HDF5 header version does not match with the HDF5 library (Linux)
- How to Install Redis server on CentOS 7 (Server)
- Revised OpenJDK Java Memory Model (Programming)
- Linux common network tools: Scan routing of mtr (Linux)
- How to fix apt-get update can not add a new CD-ROM error (Linux)
- LVM mirrored logical volume to achieve (Linux)
- DBCA Error: ORA-19809: limit exceeded for recovery files process (Database)
- The difference between vi and nano (Linux)
- libnet list of functions (Programming)
- RedHat virtual machine to install VMware Tools (Linux)
- Oracle () trunc function usage (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.