Helloo im making a project on android studio.my workbench screen size is not same working on emulator
in android studio when i developing
i got a scroolview vertical ann it got a linear layout in scrollwiew.i want to make same to every phone.
my 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>
This is happening because devices have different densities and screen sizes. Device that you test your app on has lower density screen and/or smaller screen height, so it's compressing the layout. You can design the same layout several times to work with multiple densities like hdpi, xhdpi, mdpi etc. more information can be found there: http://developer.android.com/guide/practices/screens_support.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.