سؤال

I just found the AutoResizeTextView by Chase

Auto Scale TextView Text to Fit within Bounds

But I couldn't make it run yet.

AutoResizeTextView monologTextView;
monologTextView = (AutoResizeTextView) findViewById(R.id.dialogText);

xml:

 <AutoResizeTextView
                android:id="@+id/dialogText"
                style="@style/monologText"
                android:layout_width="fill_parent"
                android:layout_height="100dp"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:ellipsize="none"
                android:singleLine="true"
                 />

Results in a android.view.InflateException.

Binary XML file line #44: Error inflating class AutoResizeTextView

When I change the XML to TextView

<TextView
                android:id="@+id/dialogText"
                style="@style/monologText"
                android:layout_width="fill_parent"
                android:layout_height="100dp"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:ellipsize="none"
                android:singleLine="true"
                 />

I receive the following runtime exception:

android.widget.TextView cannot be cast to com.gootsproject.AutoResizeTextView

How can I implenent the extended textView?

هل كانت مفيدة؟

المحلول

<AutoResizeTextView
                android:id="@+id/dialogText"
                style="@style/monologText"
                android:layout_width="fill_parent"
                android:layout_height="100dp"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:ellipsize="none"
                android:singleLine="true"
                 />

you should indicate the complete path:

<com.gootsproject.AutoResizeTextView
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top