PostVortex
1.0.0
Postvortexプロジェクトは、 Fragment内のRecyclerViewの使用を示すAndroidアプリケーションです。このプロジェクトは、League of Legends、Batman:Arkhamシリーズ、Marvel's Spider-Manなどの人気ゲームに関連するコンテンツを含む、ゲームをテーマにした投稿のダイナミックなリストの作成に焦点を当てています。このアプリは、シンプルでモジュール式になるように設計されているため、更新して拡張しやすくなります。
LinearLayoutManagerを使用してRecyclerViewを利用してアイテムのリストを表示します。RecyclerViewにバインドします。実例:
data class Post ( val title : String , val description : String , val imageUrl : String )Fragmentの使用。実例:
class ListFragment : Fragment () {
override fun onCreate ( savedInstanceState : Bundle ? ) {
super .onCreate(savedInstanceState)
retainInstance = true
}
override fun onCreateView (
inflater : LayoutInflater ,
container : ViewGroup ? ,
savedInstanceState : Bundle ?
): View ? = inflater.inflate( R .layout.fragment_main, container, false )
}RecyclerViewの実装。実例:
list_recycler_view. apply {
layoutManager = LinearLayoutManager (activity)
adapter = ListAdapter (postList)
}実例:
private val postList = listOf (
Post (
" League of Legends - Unleashing the Power of the Nexus. " ,
" Join your team and destroy the enemy Nexus in this epic battle of wits and reflexes. Every decision counts in the world of Runeterra. " ,
" https://www.mobafire.com/images/guide/9.16/lol-nexus-destruction.jpg "
),
// More posts...
)実例:
Post (
" The Dark Knight Rises Again. " ,
" Gotham's silent protector is back. Dive into the shadows with Batman as he faces off against his rogues' gallery in yet another thrilling adventure. " ,
" https://www.rockpapershotgun.com/images/2021/01/batman-arkham-asylum.jpg "
)git clone https://github.com/Pirate-Emperor/PostVortex.gitアプリケーションには、 RecyclerViewにゲーム関連の投稿のリストが表示されます。各アイテムには、タイトル、説明、画像が含まれています。コンテンツは、コードで提供されるデータモデルに基づいて動的に生成されます。