我不能为我的生活弄清楚如何让我的箱子在水平和垂直方向上居中。居中此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