我是新来的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