在Android中,如何在固定位置显示各种屏幕分辨率的控件?
在Android中,如何在固定位置显示各种屏幕分辨率的控件 我有一个屏幕设计如下在Android中,如何在固定位置显示各种屏幕分辨率的控件?,android,android-layout,Android,Android Layout,在Android中,如何在固定位置显示各种屏幕分辨率的控件 我有一个屏幕设计如下 <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="center_horizontal" android:layout_width="fill_parent" androi
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center_horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/img_background_loadbackground">
<TableRow>
<TextView
android:id="@+id/tv1"
android:layout_width="fill_parent"
android:layout_height="300sp"/>
</TableRow>
<TableRow>
</TableRow>
<ProgressBar
android:id="@+id/progressbar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableLayout>
它在HVGA(3x480)分辨率中工作,PrimeStar出现在屏幕的底部,但是如果我运行在其他分辨率(WQVGA432-240x432)中,PrimeStar就出现在屏幕的中间。我无法在固定位置显示它
我正在使用下面显示的清单文件,但没有输出<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />
我没有解决方案,所以请给我一些解决问题的想法。
< P>这取决于你如何定义你的布局:在这里发布你的布局XML会有帮助。 < P>我猜它是否在中间,你有点像:android:layout_gravity="center"
但是,是的,发布XML会有点帮助 如果你想让版面在不同分辨率的屏幕上工作,你应该以
dip
为单位来调整版面大小。例如:
android:layout_marginRight="10dip"
dip
代表独立于设备的像素,在布局中使用这些像素意味着Android将根据运行应用程序的设备的显示自动调整布局
你可以在网上看到这些。本文档还提供了一些处理不同显示的其他选项,但我认为使用dip
可能是最简单的