#The new# Material Design

 

    新的Android L使用 Material Design,增加一些新(ku xuan)的东西。

 

    1. Material Theme

 

    支持Material Theme,更有给States Bar 以及Navigation bar自定义颜色的功能。

 

@android:style/Theme.Material (dark version)
@android:style/Theme.Material.Light (light version)
@android:style/Theme.Material.Light.DarkActionBar

    

 

    2.UI Widgets

 

    新增控件:RecyclerView 、CardView 

     前者是ListView的升级版,在View的复用上作了优化,当然支持动画。CardView也是支持更加酷炫的动画,并且整体感官更易于接受。

 

    3.Views And Shadows

 

     三维来了。支持控件通过

android:elevation="2dp"

    来实现一个立体的效果

   

    3.Animations

 

     动画更加丰富多彩,给Activity设置淡入淡出动画更加方便。还有其他地方的动画。

    

Touch feedback
Reveal effect
Activity transitions
Curved motion
View state changes

 

 

 

   又更新API,什么时候用得上呢【思考

    

 

   

   

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,我可以帮您在这段代码中添加button click事件,启动新的activity。请参考下面的代码: ``` package com.example.handwriting import android.content.Intent import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.Button import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import com.example.handwriting.ui.theme.HandWritingTheme class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { HandWritingTheme { // A surface container using the 'background' color from the theme Surface( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background ) { Greeting("Android") LaunchNewActivityButton() } } } } } @Composable fun Greeting(name: String, modifier: Modifier = Modifier) { Text( text = "Hello $name!", modifier = modifier ) } @Composable fun LaunchNewActivityButton() { Button( onClick = { val intent = Intent( LocalContext.current, NewActivity::class.java ) startActivity(intent) }, modifier = Modifier.padding(top = 16.dp) ) { Text("Launch New Activity") } } @Preview(showBackground = true) @Composable fun GreetingPreview() { HandWritingTheme { Greeting("Android") } } ``` 在这个代码中,我们首先在onCreate()方法中添加了一个新的组件LaunchNewActivityButton(),它是在Material Design组件库中的Button组件的基础上实现的。在这个组件中,我们创建了一个新的Intent对象,指定了当前activity为MainActivity,目标activity为NewActivity,并启动了这个新的activity。您可以根据实际情况,修改NewActivity为您需要启动的目标activity的名称。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值