我不能爲我的生活弄清楚如何讓我的箱子在水平和垂直方向上居中。居中此Android佈局?
Download Google Chrome to see this image. http://img196.imageshack.us/img196/3593/stupidlayout.png
繼承人我的xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/dragon"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/playerinfosquare"
android:orientation="vertical">
<TextView
android:id="@+id/spellinfotitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10px"
android:text="Spellventory"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/spell1info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10px"
android:text="No Spell Equipped"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/spell2info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10px"
android:text="No Spell Equipped"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/spell3info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10px"
android:text="No Spell Equipped"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</LinearLayout>
幫助?
你在開玩笑嗎?堆棧溢出認爲它比我知道的更好,並且說我沒有足夠的內容來解釋我的代碼段。那麼,你去!這就是你擁有任意規則並不總是合理的。
這條規則很重要,因爲那裏只有大量的代碼問題。對人好點! :D – WarrenFaith 2012-03-02 00:48:56