2016-08-21 48 views
0

這是我的問題,相對佈局:秤整個佈局的Android

  1. 我有一些圖像視圖,每個ImageView的某些部分是出於 顯示屏,切緣陰性的。
  2. 我在左側 所示的顯示尺寸中設計了此佈局,這沒關係。
  3. 但在其他顯示尺寸中,我不想要顯示 的部分視圖將顯示[如右圖]。 (或者更小的 顯示一些未顯示的部分)。
  4. 等等。我想只是想要的佈局框將顯示在不同的 顯示尺寸,並根據顯示尺寸縮放。

對不起,我知道這個問題是涉及;)

enter image description here

我需要佈局在不同的顯示器尺寸比例的只是可見部分,也要意見單獨給它們的動畫。 這是一個箭頭示例代碼:

<?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"> 
    <ImageView 
     android:layout_width="4000dp" 
     android:layout_height="300dp" 
     android:rotation="15" 
     android:src="@drawable/rectangle" 
     android:layout_row="0" 
     android:layout_column="0" 
     android:id="@+id/img_rct_header" 
     android:layout_marginBottom="108dp" 
     android:layout_alignParentLeft="false" 
     android:layout_alignParentStart="false" 
     android:layout_marginLeft="-100dp" 
     android:layout_marginTop="-160dp" 
     android:layout_marginRight="-120dp" 
     android:clipChildren="false" 
     android:scaleType="fitXY" /> 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="135dp" 
     android:rotation="195" 
     android:src="@drawable/arrow_tall" 
     android:id="@+id/img_arw_in_sore" 
     android:scaleType="fitXY" 
     android:layout_marginTop="815dp" 
     android:clipChildren="false" 
     android:layout_marginRight="-8450dp" 
     android:layout_marginLeft="25dp" 
     android:visibility="gone" /> 
    <ImageView 
     android:layout_width="500dp" 
     android:layout_height="150dp" 
     android:rotation="195" 
     android:src="@drawable/arrow_svg" 
     android:id="@+id/img_arw_in_tafsir" 
     android:scaleType="fitXY" 
     android:layout_marginBottom="-50dp" 
     android:layout_alignParentLeft="false" 
     android:layout_alignParentStart="false" 
     android:layout_marginLeft="161dp" 
     android:layout_marginTop="360dp" 
     android:layout_marginRight="-1150dp" 
     android:clipChildren="false"/> 
    <ImageView 
     android:layout_width="500dp" 
     android:layout_height="150dp" 
     android:rotation="195" 
     android:src="@drawable/arrow_svg" 
     android:scaleType="fitXY" 
     android:id="@+id/img_arw_out_tafsir" 
     android:layout_marginBottom="0dp" 
     android:layout_alignParentLeft="false" 
     android:layout_alignParentStart="false" 
     android:layout_marginLeft="-272dp" 
     android:layout_marginTop="240dp" 
     android:layout_marginRight="55dp" 
     android:clipChildren="false"/> 
    <ImageView 
     android:layout_width="4000dp" 
     android:layout_height="320dp" 
     android:rotation="15" 
     android:src="@drawable/rectangle" 
     android:layout_row="0" 
     android:layout_column="0" 
     android:id="@+id/img_rct_footer" 
     android:layout_marginBottom="-800dp" 
     android:layout_alignParentLeft="false" 
     android:layout_alignParentStart="false" 
     android:layout_marginLeft="-100dp" 
     android:layout_marginTop="550dp" 
     android:layout_marginRight="-120dp" 
     android:clipChildren="false" 
     android:scaleType="fitXY" /> 

</RelativeLayout> 

感謝您的幫助;)

+0

上傳你的圖片 –

+0

我的問題似乎沒有答案。我發現一個庫並沒有解決我的問題,但也許可以解決這樣的問題: https://github.com/intuit/sdp/blob/master/sdp-android/src/main/res/layout/sdp_example.xml – Solivan

回答

0

您的佈局是相當複雜的。如果你只想把這個背景看作是不同屏幕尺寸的背景,我建議你單獨繪製背景,將其保存爲高質量的PNG,然後將其放在一個ImageView中,而不是全部邊際和旋轉的麻煩。

+0

@Solivan我很抱歉,但我不完全明白你的意思。你能解釋更多嗎? (也許顯示更詳細的圖像) – amitairos

+0

我看到了你的編輯。請張貼您的整個xml,而不僅僅是imageview。 – amitairos

+0

再次感謝,但問題是我想單獨製作動畫視圖,並且您的解決方案不可能。 – Solivan

0

您必須將佈局的背景設置爲該圖片以便不顯示在dp中。

的DP大小類似於屏幕的像素和它讓其他設備更小和更大的請嘗試使用4000dp

價值match_parent,而不是最好的辦法是使用像PicsArt不僅或picsay應用。只要把所有的圖片在一個圖片編輯的圖片,然後讓整個佈局與這些值的背景

layout_width="match_parent" 
layout_height="match_parent" 

,但如果你想製作動畫,你必須將佈局添加到另一個佈局 ,並給他們layout_weight