I am trying to inflate an ImageView that scales a Drawable that I can display in a GalleryView. My code to inflate the view seems to work fine, except that the attributes o
The trick is simply to use the following version of inflate():
inflater.inflate(R.layout.gallery_item, parent, false);
The last two parameters are mandatory. If you pass "null" as the parent, the inflater does not know what type of layout parameters to create and therefore ignores all the android:layout_ XML attributes. The last parameter simply tells the inflater to not add the inflated view to the parent right away. If you pass true (at least inside an Adapter's getView() method), bad things will happen.