Android 相对/表布局问题
我希望TextView始终位于每个EditText的顶部,在设备的所有屏幕上。首先,我试着用RelativeLayout做点什么,但没用。现在,我正在尝试使用TableLayout。我想你的意见为最好的布局为这个用途 这是我的密码:Android 相对/表布局问题,android,layout,android-relativelayout,tablelayout,Android,Layout,Android Relativelayout,Tablelayout,我希望TextView始终位于每个EditText的顶部,在设备的所有屏幕上。首先,我试着用RelativeLayout做点什么,但没用。现在,我正在尝试使用TableLayout。我想你的意见为最好的布局为这个用途 这是我的密码: <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="2"
android:background="@drawable/back" >
<TextView android:id="@+id/mathimatika"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Mathimatika Kateuthinsis"
android:textColor="#09074c"
android:textSize="14px"
android:gravity="center" />
<TableRow>
<TextView
android:layout_column="1"
android:text="Profwrika a"
android:padding="13dip"
android:textColor="#09074c"
android:textSize="10px"/>
<TextView
android:text="Profwrika b"
android:gravity="center"
android:textColor="#09074c"
android:textSize="10px" />
<TextView
android:text="grapta"
android:gravity="right"
android:padding="13dip"
android:textColor="#09074c"
android:textSize="10px" />
</TableRow>
<RelativeLayout>
<EditText
android:id="@+id/input11"
android:layout_width="60px"
android:layout_height="wrap_content"
android:textSize="18sp"
android:numeric="decimal|signed"
android:layout_below="@id/vathmos1"
android:layout_marginLeft="13dip" />
<EditText
android:id="@+id/input21"
android:layout_width="60px"
android:layout_height="wrap_content"
android:textSize="18sp"
android:numeric="decimal|signed"
android:layout_toRightOf="@id/input11"
android:layout_below="@id/vathmos1"
android:layout_marginLeft="25px" />
<EditText
android:id="@+id/input31"
android:layout_width="60px"
android:layout_height="wrap_content"
android:textSize="18sp"
android:numeric="decimal|signed"
android:layout_toRightOf="@id/input21"
android:layout_below="@id/vathmos1"
android:layout_marginLeft="25px" />
</RelativeLayout>
</TableLayout>
嗯,你可以和一个亲戚一起做。you,我不明白你为什么说你做不到。但是,如果要将其用于TableLayout,则需要有两个TableRow,一个带有TextView,另一个带有EditText。因此,TableLayout的子项将是TableRows 但是,我建议您使用RelativeLayout,它更便宜,因为它不需要计算内容,而且它在堆栈中只有一个级别 可以先定义三个EditText,然后定义每个EditText上方的三个文本视图,如果希望它们居中,则可以将左侧和右侧与EditText对齐。 我希望这有帮助,让我知道你的想法