Monday, September 16, 2013

Re: [android-developers] Re: Problems with Custom Image View

Use MeasureSpec.getSize(heightMeasureSpec) instead of getMeasureHeight()  (i think just calling super.onMeasure(heightMeasureSpec, heightMeasureSpec) should work as well)
Also, your last TextView should have its width set to 0dp.




On Monday, September 16, 2013 6:46:06 AM UTC+3, Napster wrote:
@Piren,
The xml for the row is as below. Please take a look.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp" >
 
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
 
<com.viktorq.widgets.IconView
android:id="@+id/iv_order_status"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginRight="10dp"
android:src="@drawable/ic_launcher" />
 
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
 
<TextView
android:id="@+id/tv_order_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="16sp"
android:textStyle="bold" />
 
<TextView
android:id="@+id/tv_order_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="10sp" />
 
<TextView
android:id="@+id/tv_laundry_pounds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
 
<TextView
android:id="@+id/tv_total"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical|right"
android:text="TextView"
android:textColor="#578F50"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
 
</RelativeLayout>

I will also send the bordered screenshot soon.


On Sun, Sep 15, 2013 at 11:53 AM, Piren <gpi...@gmail.com> wrote:
How did you define the xml for the row item?
It would also be helpful if you turn on the developer option to show layout borders and provide another screen cap


On Sunday, September 15, 2013 6:06:54 AM UTC+3, Napster wrote:
The paste is in here : http://paste.ubuntu.com/6108587/
And here is a screenshot of the current output.

Inline image 1


On Sun, Sep 15, 2013 at 8:30 AM, Subin Sebastian <subinse...@gmail.com> wrote:
Hello Group,

I have created a custom ImageView to show icons in my list view items. The idea is to show, perfectly square icons with each list view items. The following is the code fragments I have.

public class IconView extends ImageView {    	public IconView(Context context, AttributeSet attrs, int defStyle) {  		super(context, attrs, defStyle);  	}    	@Override  	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {  		super.onMeasure(widthMeasureSpec, heightMeasureSpec);  		int height = getMeasuredHeight();  	    setMeasuredDimension(height, height);  	}  }

and the XML is,

<com.napster.widgets.IconView              android:id="@+id/iv_order_status"              android:layout_width="wrap_content"              android:layout_height="fill_parent"              android:layout_marginRight="10dp"              android:background="#567567"              android:src="@drawable/ic_launcher" />

The problem with this approach is that, the rest of the views in the list cell, goes out of display partially. I tried to invalidate() the "convertView" in my adapter's getView() method, but it does not seem to work. How to solve this problem?

--
Thanks & Regards
--
Subin Sebastian
http://in.linkedin.com/in/subinsebastien




--
Thanks & Regards
--
Subin Sebastian
www.nintriva.com
http://subinsebastien.tumblr.com
http://in.linkedin.com/in/subinsebastien
http://plus.google.com/subin
http://facebook.com/subinsebastien

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-d...@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
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 android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Thanks & Regards
--
Subin Sebastian
www.nintriva.com
http://subinsebastien.tumblr.com
http://in.linkedin.com/in/subinsebastien
http://plus.google.com/subin
http://facebook.com/subinsebastien

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
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 android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate