2016-03-05 175 views
-2

這是我的痛點。我是Android新手,我想創建啓動畫面到應用程序。目前,在這個論壇中搜索後,我發現了從圖片中實現啓動畫面的方法,但這不是我想要的。我想讓初始屏幕變成漸變漸變的顏色。附在這個問題上的圖片來說明我的意思。 不幸的是,由於我的信譽度低,無法粘貼圖像。儘管如此,這是一個梯度圖像link。 進一步解釋,我希望動態生成java或xml代碼的顏色,這樣我就不必擔心不同的屏幕尺寸,因爲我必須做的就是生成全屏顯示的所有內容。如果可能,我試圖避免使用圖片資產。 幫助Plz。由於初始屏幕和漸變

+0

你可能會得到如果您顯示用於顯示啓動畫面圖像的代碼並詢問「如何更改以顯示漸變?」,則可以獲得更好的答案。 –

回答

3

創建一個形狀,將其添加到像繪項目:<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="@color/gradient_start" <!--this first color --> android:endColor="@color/gradient_end" <!--this second color --> android:angle="-270" /> <!--gradient angle --> </shape>

,然後在你的splash.xml背景,設置背景形狀

添加

<LinearLayout 
    android:id="@+id/ranking_order" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/list_grad" 
    />