Giter VIP home page Giter VIP logo

listincompose's Introduction

    学习了compose中的列表和状态,列表和Android中的recyclerView和listView的使用效果差不多,但是compose是用kotlin写的,kotlin一般都喜欢和拉姆达表达式一块连用,当给列表中的每一个元素赋值的时候,确实比recyclerview简单
    状态我感觉是用来保存一个变量的状态,这次写的demo中状态就是为了保存你是否点击过列表中的元素,如果该元素没被点击则为false,若该元素被点击则为true
    这个demo主要就是实现一个类似recyclerview的东西,并且实现了如果没点之前最多是1行,点击之后则把所有的字都显示出来

    遇到的一个疑惑
    没看到后面,感觉remember能保存的不会太多,我第一次点第一个让它的字体变了一个颜色,刷到下面然后再往回去看,字体颜色变回去了

    动画
    在该demo中,它的动画主要体现在按字的时候字体的颜色会逐渐发生变化,虽然我看不出来
    用val surfaceColor:Color by animateColorAsState(if(isExpanded) MaterialTheme.colors.primary else MaterialTheme.colors.secondary)
该段代码,让按之前字体的颜色是MaterialTheme.colors.secondary,按之后是 MaterialTheme.colors.primary,用surface把你要进行变化的那段字包裹起来
 shape = MaterialTheme.shapes.small,
                //large直接没有弧度,medium有一点弧度,small的弧度最大
                elevation = 100.dp,
                //设置阴影大小
                  modifier = Modifier.animateContentSize().padding(1.dp)//这个是真不知道干嘛用的,唯一一点就是我改变padding里面的dp大小,不用进行重新编译,就会进行变化

listincompose's People

Contributors

flymetwothemoon avatar

Stargazers

Cai. avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.