जब मैं बटन पर क्लिक करें, फ़ॉन्ट आकार सिकुड़ता है 12. करने के लिए हालांकि, परिणाम है:एंड्रॉयड: TextView ऊंचाई फ़ॉन्ट आकार सिकुड़ के बाद परिवर्तन नहीं करता है
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40sp"
android:background="#80ff0000"
android:text="@string/hello" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
जावा:
public class FontSizeTestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final TextView text = (TextView) findViewById(R.id.test);
Button button1 = (Button) findViewById(R.id.button1);
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
text.setTextSize(12);
}
});
}
}
मैं कैसे श्री करते एनके टेक्स्ट की ऊंचाई देखें ताकि यह केवल वास्तविक फ़ॉन्ट को लपेट सके?
मैं सिर्फ अपने कोड का परीक्षण किया और यह एकदम सही ढंग से काम करता है। एंड्रॉइड का कौन सा संस्करण आप उपयोग कर रहे हैं? – caiocpricci2
मैंने एंड्रॉइड 3.2 और 4.0 – jclova
पर परीक्षण किया है इनमें से कोई भी समाधान एंड्रॉइड के किसी भी संस्करण पर मेरे लिए काम नहीं करता है। T__________T – Magicode