小编Pav*_*rma的帖子

如何为材质按钮设置渐变背景?

我目前正在使用此代码,但背景没有改变。它仍然显示强调色作为背景。

<com.google.android.material.button.MaterialButton
    android:id="@+id/materialButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hello"
    app:cornerRadius="32dp"
    android:background="@drawable/gradiant_blue"/>
Run Code Online (Sandbox Code Playgroud)

gradiant_blue.xml

<shape
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:shape="rectangle">

   <gradient
       android:angle="-45"
       android:startColor="#2979FF"
       android:endColor="#7C4DFF"/>
</shape>
Run Code Online (Sandbox Code Playgroud)

我目前正在使用

材料组件版本:1.0.0-rc02

android android-button android-drawable material-components-android

14
推荐指数
2
解决办法
9592
查看次数

用于获取未见趋势帖子的 Firebase Firestore 结构 - 社交

这是当前的示例结构

Posts(Collection)
    - post1Id : {
          viewCount : 100,
          likes     : 45,
          points    : 190,
          title     : "Title",
          postType  : image/video
          url       : FileUrl,
          createdOn : Timestamp,
          createdBy : user20Id,
          userName  : name,
          profilePic: url
      }
Users(Collection)
    - user1Id(Document):{
          postsCount : 10,
          userName  : name,
          profilePic : url
      }
        viewed(Collection)
            - post1Id(Document):{
                  viewedTime : ""
              }
                 
    - user2Id(Document)
Run Code Online (Sandbox Code Playgroud)

最终目标是

  • 我需要获取当前用户未查看的帖子,并按分页降序排列。

可能的最佳解决方案是什么(例如改变结构、云功能、客户端多次查询)?

firebase google-cloud-firestore

5
推荐指数
1
解决办法
1501
查看次数