---------------------------------------之前的一些知识点:----------------------------------------------------
修改空间的布局:
首先每个推荐之间是有间隙的,
注意,包含的结构是这样的:activity_main.xml->fragment_home.xml->recommend_item.xml->album_item.xml
所以每个推荐之间的间隙,只要在recommend_item 里面修改添加marginTop的数值就可以了,还有给每个推荐修改背景色为白色
还有为了修改间隙之间的颜色修改fragment_home的背景色为灰色的。就可以了

还有 显示 的 title,一般都是如果超出了范围了 就是使用限制了 。
设置当TextView中的文字超过TextView的容量时,用省略号代替
只需要下边的设置:
 
textview.setSingleLine(); 
textview.setEllipsiz(TextUtils.TruncateAt.valueOf("END"));
 
在xml中设置如下:
 
android:singleLine="true"
android:ellipsize="end"

android:singleLine="true"
android:ellipsize="end"
---------------------------------------之前的一些知识点:----------------------------------------------------

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
发现新奇:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
由于RecyclerViewAdapter已经实现是了多布局的复用,那么现在要做的
1:首先做一个布局discovery_item.xml,这个里面 要绑定一个 discovery的一个变量。
2: 然后做一个discovery_columns.xml的布局文件,将上面的 discovery_item绑定到这个来。
3:将该布局添加到到HomeFfragment里面。

在写discovery_item.xml 的时候
注意 SimpleDraweeView 里面的设置:
app:placeholderImage="@mipmap/ic_launcher"
        app:imageURI="@{ Uri.parse( discovery.coverPath ) }"//靠!!!imageURI的i是小写的。
这里的面的最顶层的LinearLayout 可以不写

include的时候需要,导入这个layout里面的变量呢?
bind:user="@{user}"

注意 图片 这里 app:imageURI="@{ Uri.parse( discovery.coverPath  ?? ``) }"

++++++++++++++++++++++++++++
靠!!!imageURI的i是小写的。
++++++++++++++++++++++++++++

在discovery_item.xml的顶层Layout 里面添加:
android:layout_marginTop="2dp"
    android:background="@android:color/white"

现在的discovery_item.xml
-------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"><data><import type="android.net.Uri"/><variable name="discovery" type="com.kodulf.ximalayating.entities.DiscoveryEntity"/></data>
<LinearLayout
    android:layout_marginTop="2dp"
    android:background="@android:color/white"
    android:orientation="horizontal" ><com.facebook.drawee.view.SimpleDraweeView
        android:layout_width="40dp"
        android:layout_height="40dp"
        app:placeholderImage="@mipmap/ic_launcher"
        app:viewAspectRatio="1"
        app:imageURI="@{ Uri.parse( discovery.coverPath  ?? ``) }"
        ></com.facebook.drawee.view.SimpleDraweeView>
<LinearLayout
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:orientation="vertical"><TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@{ discovery.title }"></TextView><TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@{ discovery.subtitle }"></TextView>
</LinearLayout>
</LinearLayout>
</layout>

-------------------------------------------------------------

discovery_columns.xml
--------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:bind="http://schemas.android.com/tools"><data><variable
            name="discoveryColumns"
            type="com.kodulf.ximalayating.entities.DiscoveryColumns"/></data><LinearLayout android:orientation="vertical" android:layout_width="match_parent"
        android:layout_height="wrap_content"><LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"><TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                text="@{ discoveryColumns.title }"/></LinearLayout>
<LinearLayout
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="wrap_content"><include
        layout="@layout/discovery_item"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        bind:discovery="@{ discoveryColumns.list[0] }"
    /><include
        layout="@layout/discovery_item"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        bind:discovery="@{ discoveryColumns.list[1] }"
        /><include
        layout="@layout/discovery_item"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        bind:discovery="@{ discoveryColumns.list[2] }"
        /><include
        layout="@layout/discovery_item"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        bind:discovery="@{ discoveryColumns.list[3] }"
        /></LinearLayout></LinearLayout>
</layout>

--------------------------------------------------------------
HomeFragment里面添加两句话:
map.put(DiscoveryColumns.class,new BindingAdapter.BindingTool(R.layout.discovery_columns,BR.discoveryColumns));
        
adapter.add(body.getDiscoveryColumns());

package com.kodulf.ximalayating.fragments;import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.databinding.tool.reflection.Callable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;import com.kodulf.ximalayating.BR;
import com.kodulf.ximalayating.R;
import com.kodulf.ximalayating.adapters.BindingAdapter;
import com.kodulf.ximalayating.databinding.FragmentHomeBinding;
import com.kodulf.ximalayating.entities.DiscoveryColumns;
import com.kodulf.ximalayating.entities.DiscoveryEntity;
import com.kodulf.ximalayating.entities.HomeEntity;
import com.kodulf.ximalayating.entities.RecommendEntity;
import com.kodulf.ximalayating.utils.NetworkUtil;import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;import retrofit2.Callback;
import retrofit2.Response;/**
 * A simple {@link Fragment} subclass.
 */
public class HomeFragment extends Fragment implements Callback<HomeEntity> {private BindingAdapter adapter;public HomeFragment() {// Required empty public constructor
    }@Override
    public void onCreate(@Nullable Bundle savedInstanceState) {super.onCreate(savedInstanceState);HashMap<Type,BindingAdapter.BindingTool> map = new HashMap<>();map.put(RecommendEntity.class,new BindingAdapter.BindingTool(R.layout.recommend_item, BR.recommend)); map.put(DiscoveryColumns.class,new BindingAdapter.BindingTool(R.layout.discovery_columns,BR.discoveryColumns));adapter = new BindingAdapter(map, new ArrayList<>(), getContext());NetworkUtil.getService().getHome().enqueue(this);}@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {// Inflate the layout for this fragment
//        return inflater.inflate(R.layout.fragment_home, container, false);
        //初始化的时候需要修改了,不要上面的inflater了。
        FragmentHomeBinding binding = DataBindingUtil.inflate(inflater, R.layout.fragment_home, container, false);binding.homeRecycler.setAdapter(adapter);return binding.getRoot();}@Override
    public void onResponse(Response<HomeEntity> response) {
//        Toast.makeText(getContext(),"返回",Toast.LENGTH_LONG).show();
        HomeEntity body = response.body();adapter.add(body.getEditorRecommendAlbums());adapter.addAll(body.getHotRecommends().getList());adapter.add(body.getDiscoveryColumns());}@Override
    public void onFailure(Throwable t) {t.printStackTrace();}
}

Test XiMaLaYa 新奇部分的添加相关推荐

  1. 【听】像ted一样演讲,论公众场合打鸡血的技巧

    像ted一样演讲,一本关于演讲技巧的书籍,作者研究了ted的演讲,找出共同特点,研究分析演讲的技巧,做到如何像ted一样的演讲效果. 演讲无疑是最好的推销自己的方式,现今如此剧烈的内卷化,人人几乎都是 ...

  2. 历届 SIGGRAPH 上有什么新奇、有趣的项目?

    from: https://www.zhihu.com/question/25064719 历届 SIGGRAPH 上有什么新奇.有趣的项目? 1 条评论 默认排序按时间排序 13 个回答 王立武CS ...

  3. 差分进化算法_特邀嘉宾 | 科普差分进化算法(创新奇智运筹优化算法工程师朱小龙博士)...

    文案:段克邪 排版:随心390 hello,大家好.各位可点击此处,访问公众号官方店铺.谨防上当受骗,感谢各位支持! 今天我们有幸请到创新奇智运筹优化算法工程师朱小龙博士为大家科普差分进化算法,本次推 ...

  4. 如何给影像添加投影_地面互动投影是如何实现的,需要哪些设备?

    系统通过将的投影设备和互动投影技术结合在一起产生一种新奇的交互体验.悬挂在顶部的投影设备将影像效果投射在地面上,只要有观众踏进投影机投射的影像区域内,多媒体系统就会感应识别到,从而记录观众的肢体动作并 ...

  5. phpstorm如何同时打开两个文件夹_iPhone如何同时添加两个不同的面容ID?

    iPhone 8 及之前使用 Touch ID 的设备,可以同时添加多个指纹来解锁设备,这样就可以添加其他人来解锁自己的 iPhone. 在iPhone X及之后的设备上,使用的都是面容识别解锁,其实 ...

  6. 服务器增加驱动器,向存储空间直通添加服务器或驱动器

    向存储空间直通添加服务器或驱动器 11/06/2017 本文内容 适用于:Windows Server 2019.Windows Server 2016 本主题介绍如何向存储空间直通添加服务器或驱动器 ...

  7. 栋的月结 | 第二回合(定期更新、动态、架构、云技术、算法、后端、前端、收听/收看、英文、书籍、影视、好歌、新奇)[含泪总结.. 憋泪分享!]

    开篇词 大家好!以下是我在 2020 年 2 月 1 日至 29 日的所见.所闻.所学和所悟. 现在,我把它们安利给你们. 定期更新 原创专栏: 一文搞定 Linux 管理员手册:既简单又深刻 官方授 ...

  8. 栋的周评 | 第七回合(定期更新、动态、架构、云技术、算法、后端、前端、收听/收看、英文、书籍、影视、好歌、新奇)

    开篇词 大家好!以下是我在 2020 年 2 月 10 日至 16 日的所见.所闻.所学和所悟. 现在,我把它们安利给你们. 定期更新 原创专栏: 栋的周评 一文搞定 Linux 管理员手册:既简单又 ...

  9. 栋的周评 | 第八回合(定期更新、动态、架构、云技术、算法、后端、前端、收听/收看、英文、书籍、影视、好歌、新奇)

    开篇词 大家好!以下是我在 2020 年 2 月 17 日至 23 日的所见.所闻.所学和所悟. 现在,我把它们安利给你们. 定期更新 原创专栏: 栋的周评 一文搞定 Linux 管理员手册:既简单又 ...

最新文章

  1. turtlebot3安装遇到的问题总结
  2. 河南省高中毕业会考计算机考试,河南高中会考等级划分标准
  3. 线性复杂度的素数筛选法
  4. Codeforces Global Round 3 A. Another One Bites The Dust
  5. Java面向对象(二)面向对象的特征 --- 封装 、 继承、 多态
  6. Spring如何将事件分配给专门的监听器?
  7. 网易数据运河系统NDC设计与应用
  8. 华为java开发面试难不难,秀出天际!
  9. 设置自动清理mysql binlog日志和手动删除的方法
  10. 安卓短信功能全解:调用系统短信功能发送短信、彩信,使用SmsManager发送短信,并监听发送短信的投递情况,使用广播接收器监听接收的短信。
  11. 对数组操作[:,:4]
  12. 雾里看花之 Python Asyncio
  13. 由于找不到vcruntime140_1.dll,无法继续执行代码
  14. Gabor滤波器详解
  15. 为什么大人学英语这么难?
  16. python怎么算反三角函数_python弧度制转换 三角函数 反三角函数 双曲 反双曲 sin cos tan asin acos atan asinh acosh atanh atanh2...
  17. 为何美团、抖音都潜入社群团购?毫无疑问社群团购是大趋势。
  18. ip_forward 权限不够
  19. 备选统驭科目(Alternative Reconciliation Accounts)配置及实操演示
  20. visio的.vsd格式文件转换.eps格式文件的方法+Gsview裁剪EPS文件

热门文章

  1. 智能中控集成展馆博物馆展厅荧幕控制系统背景墙视频播放器
  2. Flutter入门实战教程:从0到1仿写web版掘金App (完结)
  3. Webservice与Socket接口调用的区别和比较
  4. 云开发、自定义组件、分包加载、基础库兼容问题、骨架屏使用
  5. 自适应网站怎么做好些?
  6. 视频会议业务接力增长,“云+端”战略布局未来
  7. ZooKeeper客户端源码(零)——客户端API使用
  8. 2022,了解云原生技术栈收藏这一篇就够了(附学习笔记)
  9. el-button自定义图片显示
  10. 区块链下一个入口之证券型代币STO交易所