I am trying everything to get this to work, but to no avail. I tried using (AutoResizeTextView) located here: Autoscale TextView Text to insert within
I created a new class file in my project called "AutoResizeTextView" and pasted the above code.
Then I opened the main.xml file and placed n the following code:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <com.mn.rl.AutoResizeTextView android:id="@+id/tv" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout>
in the mainActivity.java file, I have the following code:
package com.mn.rl; import android.app.Activity; import android.os.Bundle; public class rlActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); com.mn.rl.AutoResizeTextView txt = (com.mn.rl.AutoResizeTextView) findViewById(R.id.tv); txt.setText("Hello"); } }
I have no errors in the code, and it works, but there is no autoresist. the text remains the same size. in xml, I have autoresize textview layout_width and layout_height to populate the parent, but the font remains small. also tried txt.resize().
What am I doing wrong? Please, help.
source share