You don't get LayoutParams until you attach the view to a parent, and you are not doing that.
On Jan 18, 11:41 am, harvinder <[email protected]> wrote: > I have following code in my Adapter's getView(...) function > > <http://developer.android.com/reference/android/widget/Adapter.html#ge..., > android.view.View, > android.view.ViewGroup)>View<http://developer.android.com/reference/android/view/View.html> > getView(int position, > View<http://developer.android.com/reference/android/view/View.html> > convertView, > ViewGroup<http://developer.android.com/reference/android/view/ViewGroup.html> > parent) > { > if ( convertView == null) { > view = > LayoutInflater.from(getContext()).inflate(R.layout.program_item, null); > } > LayoutParams params = > view.getLayoutParams<http://developer.android.com/reference/android/view/View.html#getLayo...()> > (); > > } > > params is always null. > Any idea what am doing wrong? > > The intent is too change the width of the view based on the data (position) > in adapter and keep the height as defined in the xml (program_item.xml). -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

