Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android imageView in the Src and Background     - VMware6 achieve nat Internet (Linux)

- Several Ceph performance optimization of new methods and ideas (2015 SH Ceph Day after flu reference) (Server)

- To install the latest version of the EPEL on CentOS 5.x or 6.x (Linux)

- MySQL Installation Troubleshooting (Database)

- RHEL5 multipath configuration (Linux)

- Why is the ibdata1 file growing in MySQL? (Database)

- Use LKM change the default linux security level (Linux)

- Manage SQL Server services login (start) account and password (Database)

- Linux uses shared memory communication process synchronization Withdrawal (Programming)

- Ubuntu 14.04 installed NVIDIA graphics driver (Linux)

- Use netcat [nc] command on Linux and Unix port scan (Server)

- SUSE Linux install Oracle 10g and problem solving (Linux)

- LNMP summary of the issues common 502 Bad Gateway (Server)

- Boost notes --Thread - problems encountered in the initial use on Ubuntu (Programming)

- RedHat 6.5 installation and deployment Openfire (Server)

- Zend Studio PHP syntax color scheme to export (Linux)

- Android first line of code study notes (Programming)

- Linux command line to put on your coat GUI (Linux)

- How to create a secure and easy to remember password (Linux)

- How to ensure the Linux SSH login security with one-time password (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:      
 
- Linux security concerns again (Linux)
- Analysis of Java in the deep copy and shallow copy (Programming)
- Tomcat itself through simple movement separation (Server)
- Linux Operating System Security Management describes the top ten tricks (Linux)
- Binary tree and some basic operations with binary list (Programming)
- using Docker Kitematic on windows (Linux)
- Ubuntu install Geary (Linux)
- Nginx Proxy timeout Troubleshooting (Server)
- On event processing browser compatibility notes (Programming)
- The easiest 11g Active DataGuard (ADG) to establish the configuration process (Database)
- CentOS environment prepared crontab scheduled tasks (Linux)
- CentOS 6.6 command-line automatic completion (Linux)
- SSH does not require a password to log on to a Linux server (Server)
- Examples of RAID levels and achieve Operational Details (Linux)
- C language binary tree counts words (Programming)
- LVM Disk Manager Application (Linux)
- Linux / Windows setup is complete port range (Linux)
- The Hill sorting algorithm (Programming)
- Java-- get the reflection object information (Programming)
- Linux mention the right notes (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.