现在的小说推荐算法是看的人越多就越有可能被推荐,那看的人少的优秀作品就不容易被发现。这类作品往往前面不够吸引人,但中后期精彩。那搞一个最新3章好看排行榜可能会解决这个问题。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="小说结尾排行榜"
android:textColor="#ff0000"
/>
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
package com.example.myapplication5;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class ListActivity extends AppCompatActivity {
ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
//2、绑定控件
listView=(ListView) findViewById(R.id.list_view);
//3、准备数据
String[] data={"斗破苍穹","神印王座","大唐双龙传","诛仙"};
//4、创建适配器 连接数据源和控件的桥梁
//参数 1:当前的上下文环境
//参数 2:当前列表项所加载的布局文件
//(android.R.layout.simple_list_item_1)这里的布局文件是Android内置的,里面只有一个textview控件用来显示简单的文本内容
//参数 3:数据源
ArrayAdapter<String> adapter=new ArrayAdapter<>(ListActivity.this,android.R.layout.simple_list_item_1,data);
//5、将适配器加载到控件中
listView.setAdapter(adapter);
}
}