Android 我的应用程序的Texy=t在galaxy上非常小,在Vergin移动设备上占据了整个屏幕
我尝试根据屏幕大小使用不同的xml文件,将它们放在不同的文件夹中, 小布局、普通布局、大布局、xlarg布局 我的Galaxy平板电脑正在使用大布局中的布局,但是 我的vergin手机和Galaxy手机正在layout normal文件夹中获取布局 谷歌是根据屏幕大小而不是屏幕分辨率来选择布局的吗?在设置字体大小时,我使用的是dp,我认为是每英寸点数。但在vergin手机上,文字实在太大了,而在银河系上,文字读起来几乎太小了 xml文件Android 我的应用程序的Texy=t在galaxy上非常小,在Vergin移动设备上占据了整个屏幕,android,Android,我尝试根据屏幕大小使用不同的xml文件,将它们放在不同的文件夹中, 小布局、普通布局、大布局、xlarg布局 我的Galaxy平板电脑正在使用大布局中的布局,但是 我的vergin手机和Galaxy手机正在layout normal文件夹中获取布局 谷歌是根据屏幕大小而不是屏幕分辨率来选择布局的吗?在设置字体大小时,我使用的是dp,我认为是每英寸点数。但在vergin手机上,文字实在太大了,而在银河系上,文字读起来几乎太小了 xml文件 <LinearLayout xmlns:androi
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#005F5F5F"
>
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Layout-normal"
android:layout_gravity="center"
android:textColor="#ff000000"
android:textStyle="bold"
/> </LinearLayout>
<ScrollView
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BitcoinDark"
android:layout_gravity="center"
android:textColor="#ff000000"
android:textStyle="bold"
android:textSize="20px"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Values Provided By Bittrex"
android:layout_gravity="center"
android:textColor="#ff000000"
android:textStyle="bold"
android:textSize="20px"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon"
android:id="@+id/fred"
android:layout_gravity="center"
android:layout_marginTop="12px"
/>
<LinearLayout
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="High"
android:layout_gravity="center"
android:textColor="#ff000000"
android:textStyle="bold"
android:textSize="20px"
/>
<TextView
android:id="@+id/textHigh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Value"
android:layout_gravity="center"
android:textColor="#ff000000"
android:textStyle="bold"
android:textSize="20px"
android:layout_marginLeft="12px"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Low"
android:layout_gravity="center"
android:textColor="#ff000000"
android:textStyle="bold"
android:textSize="20px"
/>
<TextView
android:id="@+id/textLowest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Value"
android:layout_gravity="center"
android:textColor="#ff000000"
android:textStyle="bold"
android:textSize="20px"
android:layout_marginLeft="12px"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Volume"
android:textColor="#ff000000"
android:textStyle="bold"
android:textSize="20px"
/>
<TextView
android:id="@+id/textVol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Value"
android:textColor="#ff000000"
android:textStyle="bold"
android:layout_marginLeft="12px"
android:textSize="20px"
/>
</LinearLayout>
<Button
android:id="@+id/butRef"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24px"
android:text="Refresh"
android:textColor="#ff000000"
android:layout_gravity="center"
android:layout_marginTop="12px"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>
px是一个像素。
sp是与比例无关的像素。
dip是与密度无关的像素。
你会用
sp for font sizes
dip for everything else.
倾角==dp
px
Pixels - corresponds to actual pixels on the screen.
in
Inches - based on the physical size of the screen.
mm
Millimeters - based on the physical size of the screen.
pt
Points - 1/72 of an inch based on the physical size of the screen.
dp
Density-independent Pixels - an abstract unit that is based on the physical density of the
screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen.
The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct
proportion. Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with
"sp".
sp
Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font
size preference. It is recommend you use this unit when specifying font sizes, so they will be
adjusted for both the screen density and user's preference.