我試圖設計佈局(基本上是一個閃屏),顯示在屏幕的幾乎中間和標識下的公司標語在App標誌設置應用程序的開始。在Android Studio中工作時,佈局設計看起來像這樣。我從頂部向下定位了200dp。輸出設計並不確切是什麼,同時發展佈局
正如您所看到的,標誌正好位於屏幕中間。 但是,當我在我的模擬器上運行應用程序時,屏幕顯示如下。標誌不在我想要的確切位置。
我想我在相同的相對位置的標誌,無論屏幕尺寸多大。
假設,如果標誌位於200dp在1000dp長的屏幕。我希望它在2000dp屏幕上的400dp位置。
模擬器:5.0.0 API-21 768×1280
什麼是可能的解決方案?
以下圖像包含兩個輸出。
Follow this Link for the image
下面是XML代碼:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f84343"
android:weightSum="1">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/AppIcon"
android:src="@drawable/unnamed"
android:layout_marginTop="200dp"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/simpler_better_faster"
android:id="@+id/textView"
android:layout_gravity="center_horizontal"
android:layout_below="@+id/AppIcon"
android:layout_centerInParent="true"
android:layout_marginTop="50dp"
android:textColor="#ffffff"
android:textSize="20dp" />
</RelativeLayout>
添加相關的XML代碼。 –