Note that there are some explanatory texts on larger screens.

plurals
  1. POWebView as ListView rows not scrolling properly
    primarykey
    data
    text
    <p>I'm trying to make a <code>ListView</code> that is supposed to act something like what the stock messaging app or GTalk does. It shows a conversation between two people. The <code>WebView</code> is responsible for showing the HTML text of the conversation <strong>INCLUDING several gif animations (smileys -- which a <code>TextView</code> is incapable of showing)</strong> Obviously when a new message arrives, the list has to scroll all the way to the bottom (I'm using <code>listview.setSelection(...)</code> for that)<br> Now if the <code>WebView</code>'s height is longer than normal, the <code>ListView</code> messes up and scrolls to an item close to the end of the list and not the last item. Like I said, I think the list has problem calculating the height of it's children. (Have already disabled <code>smoothScroll</code> on the <code>ListView</code>as the documentation mentions.</p> <p>the layout file used as rows in the <code>ListView</code>: </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="#f7f7f7"&gt; &lt;ImageView android:id="@+id/imgFriendAvatarChat" android:layout_width="48dp" android:layout_height="48dp" android:layout_marginBottom="5dp" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginTop="5dp" /&gt; &lt;WebView android:id="@+id/friendMessageWebView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="5dp" android:layout_marginTop="5dp" android:layout_marginRight="5dp" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>I haven't got any useful answer for <a href="https://stackoverflow.com/questions/8434208/android-show-gif-animations-smileys-inline-with-text"><strong>this</strong></a> or <a href="https://stackoverflow.com/questions/8561866/android-prevent-unwanted-flicker-due-to-innate-webview-behavior"><strong>this</strong></a> and I'm resorting to one last solution that comes to mind which is a nasty one in deed and then I'm kissing Android goodbye! (As you can guess, I'm already fed up with Android hindering every aspect of development.)</p> <p>The solution there is using <code>WebView</code> as <code>ListView</code> rows to show what I want. The problem is that if the content of the <code>WebView</code> is say, 3 lines, then the ListView goes crazy and does not scroll to the bottom of the list properly. My guess is that the it fails to calculate the height of each child row and mistakenly navigates to the middle of the list instead of bottom of it. </p> <p>I have already read too many similar questions like <a href="https://stackoverflow.com/questions/8456554/listview-with-webview"><strong>this</strong></a> and I have not got a good response... </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload