Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android imageView in the Src and Background     - Use OpenWrt build WDS wireless network extension on V2 WHR-G300N (Linux)

- How to install Linux Kernel 4.4 on Ubuntu (Linux)

- Interesting example of Linux Sort command (Linux)

- CentOS 6.5 / 6.6 modify the default SSH port number (Linux)

- MySQL Tutorial: Building MySQL Cluster under Linux (Database)

- Compiling source code Nginx module installation subs_filter (Server)

- What happens after the MySQL disk space is full (Database)

- PXE install CentOS 6.4 (Linux)

- Linux process group, session daemon (Linux)

- How to Install Focuswriter 1.4.5 (Linux)

- Teach you how to ensure password security under the Linux operating system (Linux)

- OpenSSH version smooth upgrade method (Linux)

- ORA-14400: inserted partition key does not map to any partition (Database)

- Linux find command detailing (Linux)

- To install JDK1.7 and compiler Hadoop-2.7.1 under CentOS7 (Server)

- Let CentOS perform PPPoE dial-up, ADSL can be used in a network environment! (Linux)

- SecureCRT in Python scripting study guide (Programming)

- WebLogic administrator account and reset the password (Database)

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

- Cacti installation deployment under CentOS 6.6 (Server)

 
         
  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 5.6 master-slave replication configuration (Database)
- Lsblk command lists using Linux block device information (Linux)
- The Linux C truncate function clears the file notes (Programming)
- CentOS 6.5 installation VNCServer implement graphical access (Server)
- Compile and install the latest version of Redis Stable (Database)
- learning Linux ls command examples (Linux)
- CentOS 7.0 local address and configure yum source address priority (Linux)
- Questions about Linux compiler u-boot (Programming)
- Delegate in C # (Programming)
- 17 How to install the Ubuntu 14.04 and Linux Mint Kodi14 (XBMC) (Linux)
- To change CentOS7 runlevel (Linux)
- Binder began to talk about inter-process communication mechanism from Android AIDL (Programming)
- Docker use Dockerfile created since the launch of the service support SSH container mirror (Server)
- Puppet 3.x installed on Debian 7 (Server)
- Binary tree to the next node (Programming)
- How to use the command line to obtain Freely RSS source on Linux (Linux)
- Python programming style (Programming)
- Linux firewall settings -DNS server articles (Server)
- CentOS How quickly customize kernel binary RPM package (Linux)
- Use FFmpeg processing high quality GIF (Programming)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.