Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ Android imageView in the Src and Background     - Eclipse-ee Tomcat browser can not start Tomcat, and Web project service deployment (Server)

- How MAT Android application memory leak analysis (Programming)

- Nginx server load balancing dual-system availability (Server)

- Linux some lessons learned about network security (Linux)

- Valgrind * not * leak check tool (Linux)

- Configuring a Linux operating system security management services Explain (Linux)

- Linux environment MySQL master-slave synchronization (Database)

- DNF Command Tutorial (Linux)

- Java and Python use make way dictionary word search script (Programming)

- 12 Linux Process Management Commands (Linux)

- Ubuntu 14.04 kernel after the restart boot black screen to solve (Linux)

- Installation and operation GAMIT software under Linux operating system (Linux)

- Linux Network Programming - raw socket instance: MAC header message analysis (Programming)

- Linux firewall to prevent external network attacks (Linux)

- Linux non-root user uses less than 1024 ports (Linux)

- Linux network monitoring tools ntopng installation (Linux)

- AngularJS (Programming)

- Make command tutorial (Linux)

- Linux Man Page Installation (Linux)

- Redis Design and Implementation study notes (Database)

  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 *.);
- To setup NOTRACK and TRACK of conntrack in iptables (Linux)
- apt-get install openstack pkg Troubleshooting (Linux)
- Install mono offline on CentOS (Server)
- Use install_updates upgrade GAMIT / GLOBK (Linux)
- Linux process management related content (Linux)
- Linux find and xargs (Linux)
- Java memory analysis tool uses detailed MAT (Programming)
- CentOS 7 hard disk expansion toss record (Linux)
- Eclipse distributed management using GitHub project development (Linux)
- Linux account management add relevant directives (Linux)
- Linux dynamic libraries and Guide (Programming)
- MongoDB simple replication configuration (Database)
- Android will save the picture to see the album and timely (Programming)
- How to Install Redis server on CentOS 7 (Server)
- Ubuntu 12.04 kernel configuration automatically restart and crash dump (Linux)
- Linux System Getting Started Learning: Repair (Linux)
- SQL in the specific internal Oracle process (Database)
- CoreCLR compiled in Linux CentOS (Linux)
- How to Install Android Studio on Ubuntu 15.04 / CentOS7 (Linux)
- CentOS iptables firewall enabled (Linux)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.