so you add this imageview to the parent view.Like if you have linear
layout.So linearLayout.addview(d1);

On Tue, Mar 1, 2016 at 6:19 AM, Elijah Smith <[email protected]
> wrote:

> I'm trying to set an imageview totally programatically. This is all I am
> doing:
>
> ImageView d1 = new ImageView(getApplicationContext());
> d1.setImageResource(R.drawable.diamond);
> d1.setPadding(50, 50, 0, 0);
> d1.setPadding(100, 50, 0, 0);
> d1.setVisibility(View.VISIBLE);
>
>
> But the image doesn't seem to be appearing on the activity. Also note that
> it is not defined in the xml file. I believe that to be the problem, but I
> wanted to ask if that was actually neccessary. If not, then what IS my
> problem?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/android-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-developers/a2e98ea1-9454-41fb-a747-d35df14e4a8f%40googlegroups.com
> <https://groups.google.com/d/msgid/android-developers/a2e98ea1-9454-41fb-a747-d35df14e4a8f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/CABHzXATMSi9EtijS5g1SECEG5V3pbOB0C9w-15kHuCZqt8Z9PQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to