[英]android main XML works diffrent on 2.3 and 4.0
this XML works different on 2.3 and 4.0. 此XML在2.3和4.0上的工作方式有所不同。 one of that shows table row elemens left fitted but other centered.
其中之一显示表格行元素保留为左对齐,但其他居中。
thanks for your help 谢谢你的帮助
<LinearLayout android:id="@+id/Scorelistic" android:layout_marginLeft="70dp" android:layout_marginTop="30dp" android:layout_gravity="center" android:background="@drawable/bestscore" android:layout_height="267dp" android:layout_width="432dp" android:orientation="vertical" android:weightSum="1">
<TableLayout android:layout_height="fill_parent" android:weightSum="1" android:layout_marginTop="50dp" android:id="@+id/tableLayout1" android:layout_gravity="center" android:layout_width="fill_parent">
<TableRow android:layout_height="85dp" android:layout_width="wrap_content" android:id="@+id/tableRow1">
<FrameLayout android:layout_width="349dp" android:layout_height="74dp" android:id="@+id/frameLayout5">
<ImageView android:layout_height="74dp" android:id="@+id/score1" android:layout_marginLeft="80dp" android:layout_width="349dp" android:background="@drawable/birincibg" android:visibility="visible"></ImageView>
<TextView android:id="@+id/birinci" android:textSize="16sp" android:layout_marginLeft="80dp" android:gravity="center" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="#000000"></TextView>
</FrameLayout>
</TableRow>
</TableLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
This can be because you're specifying device points and so the whole layout becomes dependent on your device screen size. 这可能是因为您要指定设备点,因此整个布局取决于您设备的屏幕尺寸。 And so if your two devices have different screen sizes you see the difference.
因此,如果您的两个设备的屏幕尺寸不同,则会看到差异。 It's generally not recommended to use device points in layouts you may want to use gravity, alignments and weights instead.
通常不建议在可能要使用重力,路线和权重的布局中使用设备点。 Especially in TableLayouts you don't really need device points or so it seems
特别是在TableLayouts中,您实际上并不需要设备点,所以似乎
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.