我是新來的android編程,我剛剛發現了什麼材質設計。Android 5材質設計問題
我有幾個問題
- 我怎樣才能讓像谷歌+的或谷歌應用程序的圖標? (有色調和其他有點不同)
- 如何將材料設計添加到我的應用程序? (狀態欄和類似的東西...)
- 我該如何製作FAB? 關於狀態欄的顏色,我已經看到一些應用程序標題欄更亮,狀態欄更暗 我不希望我的應用程序像這樣 我可以對這些做些什麼?
- 如何讓我的應用在較低的API上運行?使用eclipse 請不要給我鏈接到谷歌開發者,因爲我們國家是被禁止的
我是新來的android編程,我剛剛發現了什麼材質設計。Android 5材質設計問題
我有幾個問題
關於#1,
Right click on 'app' or the beginning of your project tree > New > Image Asset
你應該可以自定義最,如果不是全部,你的圖標的問題在那裏。
關於#2,
I don't understand exactly what you're asking. You can customize your Action Bar and stuff like that if you choose.
關於#3,
轉到資源 - >繪製單擊鼠標右鍵,創建一個新的可繪製資源並將其命名爲circle.xml。現在,在新創建的文件添加以下代碼:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="8px">
<layer-list>
<item>
<shape android:shape="oval">
<solid android:color="#08000000"/>
<padding
android:bottom="3px"
android:left="3px"
android:right="3px"
android:top="3px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#09000000"/>
<padding
android:bottom="2px"
android:left="2px"
android:right="2px"
android:top="2px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#10000000"/>
<padding
android:bottom="2px"
android:left="2px"
android:right="2px"
android:top="2px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#11000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#12000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#13000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#14000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#15000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
</layer-list>
</item>
<item >
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="oval">
<solid android:color="#FFBB00" />
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="@color/ColorPrimary" />
</shape>
</item>
</ripple>
</item>
你必須注意的是,圓形封閉在一個波動標記,這個標記保證了圓圈反應觸摸與棒棒糖的連鎖反應設備。 現在去水庫 - >佈局右鍵單擊並選擇創建一個新的佈局資源,tool_bar.xml命名它和下面的代碼添加到該文件:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:elevation="2dp"
android:theme="@style/Base.ThemeOverlay.AppCompat.Dark"
android:background="@color/ColorPrimary"
xmlns:android="http://schemas.android.com/apk/res/android" />
現在進入資源 - >價值創造新的資源文件名稱爲colors.xml並添加以下代碼:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ColorPrimary">#FF5722</color>
<color name="ColorPrimaryDark">#E64A19</color> // you can change the colors if you want, this is orange
</resources>
現在轉到activity_main.xml並向其中添加以下代碼。另外請確保您將您想要在FAB內顯示的圖標添加到您的項目中。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<include
android:id="@+id/toolbar"
layout="@layout/tool_bar"
></include>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:id="@+id/frameLayout">
<TextView
android:id="@+id/TextAct1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:text="Edit this to say anything"
android:textSize="25dp" />
<ImageButton
android:layout_margin="15dp"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@drawable/ic_action"
android:background="@drawable/circle"
android:id="@+id/imageButton"
android:layout_gravity="right|bottom" />
</FrameLayout>
</RelativeLayout>
來源爲3號:http://www.android4devs.com/2015/03/how-to-make-floating-action-button-fab.html
關於#4,
使用Eclipse,它可能不會改變SDK版本正確正要右擊和屬性。打開清單文件並更改行:
<uses-sdk android:minSdkVersion="number-of-version-you-want" />
來源爲數字4:Eclipse Android Change API Level
古德勒克男人,如果你可以檢查出的鏈接。
感謝所有這一切,但在最後一部分,你說我怎麼能改變API水平,我知道,但我說我怎麼能在較低的API使用材料設計 –
在這種情況下,你的目標是哪個API? – micoror1
我不知道!但是我見過一些應用程序在api 8中工作,他們有材料設計 –
如果你不能看開發商的網站 哦IM,你可以無需通過代碼樣本看。您可以使用SDK管理器下載樣本。
例如,在樣本文件夾/ UI /視圖棒棒堂的SDK,你可以找到樣本FloatingActionButton
,CardView
,Elevation
,RevealEffect
等等。
不要問這裏,你應該嘗試在萬維網上搜索指南。你一定會找到你所提出的所有問題,並且有很多解釋。 – Rick
使用VPN,連接到Google Developers網站並開始閱讀。 – BladeCoder