ImageView and color

Description

You can even specify just a color, and the ImageView will display that color.

Example


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">
// www  .  j  a  va 2 s .c om
    <ImageView
        android:id="@+id/image2"
        android:layout_width="125dip"
        android:layout_height="25dip"
        android:src="#555555" />
</LinearLayout>

Java code


package com.java2s.myapplication3.app;
//from www . j a v a  2  s .  com
import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

    }

}
ImageView and color




















Home »
  Android »
    Android UI »




UI Basics
Action Bar
Animation
Button
Canvas
CheckBox
Clock Date Picker
Dialog
EditText
Event
Fragment
Gesture
GridView
ImageView
Layout
ListView
Map
Menu
Model
OpenGL
ProgressBar
RadioButton
Spinner
Tab
TextView
Thread
Toast
Video
View
WebView