Helloo我正在android studio上做一个项目。我的工作台屏幕大小在模拟器上不一样
in my phone when i trying
in android studio when i developing
我有一个scroolview垂直安,它在scrollwiew.l中有一个线性布局。
我的menu.xml
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="chosse one!"
android:id="@+id/textView2"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal" />
<ImageButton
android:id="@+id/imageButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@mipmap/love"
android:layout_below="@+id/textView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@mipmap/krm"
android:layout_below="@+id/imageButton"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageButton
android:id="@+id/imageButton3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@mipmap/rak"
android:layout_below="@+id/imageButton2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageButton
android:id="@+id/imageButton4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@mipmap/rght"
android:layout_below="@+id/imageButton3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageButton
android:id="@+id/imageButton5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@mipmap/left"
android:layout_below="@+id/imageButton4"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
/>
</LinearLayout>
</ScrollView>
最佳答案
发生这种情况是因为设备的密度和屏幕尺寸不同。在其上测试应用的设备的屏幕密度较低和/或屏幕高度较小,因此它正在压缩布局。
您可以多次设计相同的布局,以使用多种密度(例如hdpi,xhdpi,mdpi等)。可以在此处找到更多信息:http://developer.android.com/guide/practices/screens_support.html
关于android - android studio屏幕大小在模拟器上不一样,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29319082/