android-autofittextview icon indicating copy to clipboard operation
android-autofittextview copied to clipboard

Using AutofitTextView in widget

Open bagbyte opened this issue 9 years ago • 2 comments

I'm using AutofitTextView in a LinearLayout (A):

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="60dp"
    android:layout_height="match_parent"
    android:padding="0dp">

    <me.grantland.widget.AutofitTextView
        android:id="@+id/label"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:singleLine="true"
        />

<!-- old code
    <TextView
        android:id="@+id/label"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:singleLine="true"
        /> -->
</LinearLayout>

From my AppWidgetProvider, I'm dynamically adding some linear layout A.

On the device the Widget is not loading, an error is displayed: "Problem loading widget", but I don't see any error on logcat.

bagbyte avatar Mar 17 '15 07:03 bagbyte

Unfortunately I haven't used this library in a Widget before

grantland avatar Jul 09 '15 05:07 grantland

i know its an old issue, just saying that there is only a very limited amount of views you can use in a widget. Here is the list http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout . For some reason "me.grantland.widget.AutofitTextView" is not one of them :) In my app Im reusing the same layout in the app activity and the widget, and the view type is a simple TextView. In the app activity I use "AutofitHelper.create(mytextview);" to make it an autofittextview, sadly in the widget i could not make it work. Maybe it helps someone anyway.

tibbi avatar Jan 04 '16 20:01 tibbi