Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ Android imageView in the Src and Background     - Use NTFS-3G to mount NTFS partitions under Linux U disk and removable hard disk (Linux)

- Guide: Trickle restrict application bandwidth usage (Linux)

- Oracle data row split multiple lines (Database)

- Commonly used Linux system camouflage method (Linux)

- Analysis JavaBean (Programming)

- Configuration OpenOCD + FT2232 under Ubuntu (Linux)

- PostgreSQL export data dictionary documents (Database)

- List Leaves (Programming)

- Linux use chattr and lsattr commands to manage file and directory attributes (Linux)

- and localhost difference (Server)

- Linux disk quota-related instruction (Linux)

- Shilpa Nair interview experience sharing RedHat Linux package management (Linux)

- Depth study and understanding for individual users suicide DDoS attacks (Linux)

- Android Send HTTP POST requests (Programming)

- Docker Build a Java compiler environment (Linux)

- Du and df show disk space usage inconsistent Causes and Treatment (Linux)

- Linux / Unix system-level IO (Linux)

- The basic method RHEL6 (CentOS6) used in the source package compiled RPM: Upgrade OpenSSH articles (Linux)

- Oracle11g Trigger Debugging Record Error: PLS-00201: identifier SYS.DBMS_SYSTEM 'must be declared (Database)

- CentOS / Linux SWAP partitions added (Linux)

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

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 *.);
- mysqldump MySQL command-line tool (Database)
- Use virt-manager to create and manage virtual machines (Linux)
- The source code compiler installation Nginx 1.8.0 under Ubuntu 14.10 (Server)
- MySQL query plan key_len know all (Database)
- Linux tool curl and wget advanced use (Linux)
- ORA-00020: No more process state objects available (Database)
- MySQL completely uninstall and install Configuring Character Sets under Linux (Database)
- Linux delete duplicate files Artifact: dupeGuru (Linux)
- Classical sorting algorithm - Selection Sort (Linux)
- Install Ruby on Rails in Ubuntu 15.04 in (Linux)
- Ubuntu 15.04 using the Eclipse 4.4, Java 8 and WTP (Linux)
- Installation Mate Desktop in FreeBSD 10.1 (Linux)
- How to install PlayOnLinux 4.2.5 under Ubuntu 14.04 / 12.04 (Linux)
- Figlet use (Linux)
- DNF Command Tutorial (Linux)
- How to protect the Apache website under Linux system (Linux)
- Linux mention the right notes (Linux)
- Configuring LIDS build Linux kernel security intrusion detection system (Linux)
- How to monitor Nginx (Database)
- How to run Kali Linux 2.0 in Docker container (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.