Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - How would I embed an image into a view?

How would I embed an image into a view?

All your problems with Audio, Video and Images.

How would I embed an image into a view?

Postby SolidSora » Thu Oct 14, 2010 2:07 am

I'm trying to embed my image into my main view, but I can't find a way to get it to work right. What would I need to post in my XML or my main program to embed an image in there?

Edit: I want to use an image that I put in my res directory.
SolidSora
Junior Developer
Junior Developer
 
Posts: 24
Joined: Tue Oct 12, 2010 12:56 am

Top

Re: How would I embed an image into a view?

Postby Sathasivan » Thu Oct 14, 2010 8:59 am

use like this,

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:background="#808000"
android:layout_height="fill_parent"
>


<ImageView android:id="@+id/ImageView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/icon"></ImageView>

</LinearLayout>
Last edited by Sathasivan on Thu Oct 14, 2010 2:49 pm, edited 1 time in total.
User avatar
Sathasivan
Experienced Developer
Experienced Developer
 
Posts: 67
Joined: Wed Oct 14, 2009 7:51 am
Location: Chennai

Re: How would I embed an image into a view?

Postby blundell » Thu Oct 14, 2010 1:22 pm

Clean your code up man!
main.xml
Code: Select all
<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
  android:id="@+id/ImageView01"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:background="@drawable/icon"/>
</LinearLayout>


@drawable is a reference to the res/drawable folder

Main.class
Code: Select all

public class Main extends Activity {
  @Override
    public void onCreate(Bundle savedInstanceState) {       
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main); 
    }
}
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 8 guests