Wednesday, October 26, 2011

[android-developers] Android Relative layout issue

Hi There

Just wanted to have your point of view on the below investigation,
please read below:

Target Application:
Android standard Phone application (Gingerbread 2.3)

Issue:
On Call Log screen, shaking of phone number occurs if communication
list contains an entry (Missed call/Outgoing call) from a registered
number

You can see this shaking simply by opening an android device/emulator--
> Make a call to any registered number --> Click on standard 'Phone'
application--> Go to 'Call log' tab. You will see the number shaking
for a very short span of time before it settles down.

Investigation done so far:
It looks to be a relative layout issue:
- The layout files used for drawing list items in the Call Log screen
are (to define the position of various items to be placed in the call
log list )"recent_calls_list_item_layout.xml" and
"recent_calls_list_group_item.xml".
- Three "TextViews" have been used to display Name, Number and Time
details for a communication entry.
- Relative layout is used for positioning these items in the list
- TextView, which is used for phone number layout, for which shaking
occurs, has been made relative to the Name (label element in layout
file) and Time (date element in layout file) i.e. number will be
displayed to the left of date and to the right of label.
Refer to following code from ".\ packages\apps\Contacts\res\layout-
finger\ recent_calls_list_item_layout.xml"

<TextView android:id="@+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/label"
android:layout_toLeftOf="@id/date"
android:layout_alignBaseline="@id/label"
android:layout_alignWithParentIfMissing="true"
android:singleLine="true"
android:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceSmall"
/>

Potential cause:
Relative layout is used for label, Phone number and Time and width is
set as "wrap_content" for all three, so whenever the layout of each
communication entry is drawn, number TextView is unable to determine
its starting reference point and it does repositioning and shakes.
As a trial fix, we observed that If width of label TextView is being
fixed, then number TextView is able to determine its starting
reference point and draws it without shaking.
<TextView android:id="@+id/number"
android:layout_width="45dip"
android:layout_height="wrap_content"


Queries:
That being said, I want to know the below:
- Is similar issue likely to occur while using relative layout?
- what kind of fix is recommended under this situation, it is not
possible to change the relative layout usage or fixing the textview
width in the entire application, so we would ideally like to work upon
a framework level fix
- Any kind of suggestion/clue is highly appreciated.

Anand Swaroop Srivastava

--
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

No comments:

Post a Comment