मैं अभी शुरुआत Android डेवलपर का उपयोग करना चाहिए, मैं ग्रहण में इस रैखिक लेआउट को चलाने के लिए कोशिश कर रहा था:हार्डकोडेड स्ट्रिंग "पंक्ति में तीन", @string संसाधन
<?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">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:text="red"
android:gravity="center_horizontal"
android:background="#aa0000"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<TextView
android:text="green"
android:gravity="center_horizontal"
android:background="#00aa00"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<TextView
android:text="blue"
android:gravity="center_horizontal"
android:background="#0000aa"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<TextView
android:text="yellow"
android:gravity="center_horizontal"
android:background="#aaaa00"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:text="row one"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:text="row two"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:text="row three"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:text="row four"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
और, मैंने देखा है:
1) android:text="Yellow"
2) पीले रंग की रेखा के नीचे पीले रंग की रेखा android:text="row four"
त्रिभुज चेतावनी दी है के तहत कहते हैं [I18N] Hardcoded string "Yellow", should use @string resource "
और बाकी चेतावनियों के लिए भी। कोई सुझाव?
(दायरे से बाहर) भी, यह किसी भी तरह की तालिका जैसा दिखता है। एक टेबललेआउट हो सकता है और अधिक उपयुक्त होगा। इसके अलावा, निराश में पीटी में textsize। एसपी अधिक लचीला हैं। – njzk2
@kuffs: धन्यवाद, यह उपयोगी था –
यह @string/... क्यों नहीं है @strings/...? –