Commit 4a198700 authored by vunguyencuong's avatar vunguyencuong

Bug RecyclerView

parent 446a7e24
package com.tuya.appsdk.sample.viettelhome.home
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......@@ -11,6 +12,7 @@ import com.tuya.appsdk.sample.databinding.FragmentListDeviceItemBinding
import com.tuya.appsdk.sample.databinding.FragmentRoomBinding
import com.tuya.appsdk.sample.viettelhome.adapter.DeviceAdapter
import com.tuya.appsdk.sample.viettelhome.device.Device
import kotlin.math.log
class RoomFragment : Fragment() {
......@@ -29,11 +31,18 @@ class RoomFragment : Fragment() {
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentRoomBinding.inflate(layoutInflater)
binding.layoutListDevice.recycleListDeviceItem.apply {
layoutManager = LinearLayoutManager(requireContext())
binding = FragmentRoomBinding.inflate(inflater)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// binding.layoutListDevice.recycleListDeviceItem.apply {
// adapter = DeviceAdapter(demoList)
// }
binding.recycleListDeviceItem.apply {
Log.d("check", "onViewCreated: done")
adapter = DeviceAdapter(demoList)
}
return binding.root
}
}
\ No newline at end of file
......@@ -96,7 +96,7 @@
app:tabIndicatorFullWidth="true"
app:tabMode="scrollable"
app:tabGravity="center"
android:layout_marginStart="16dp"/>
android:layout_marginStart="16dp" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewpager2"
......
......@@ -3,6 +3,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/bg_background_radius_15">
<TextView
......@@ -50,16 +51,18 @@
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_list_device_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tv_detail_list_item"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"/>
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/recycle_list_device_item"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:layout_constraintTop_toBottomOf="@id/tv_detail_list_item"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:layout_marginStart="16dp"-->
<!-- android:layout_marginEnd="16dp"-->
<!-- app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"-->
<!-- android:orientation="vertical"-->
<!-- tools:listitem="@layout/item_device"-->
<!-- android:background="@color/red"/>-->
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -7,7 +7,8 @@
tools:context=".viettelhome.room.RoomFragment"
android:background="#F5F5F5">
<LinearLayout
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_list_device_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
......@@ -15,13 +16,30 @@
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp">
android:layout_marginEnd="16dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:orientation="vertical"
tools:listitem="@layout/item_device" />
<include
android:id="@+id/layout_list_device"
layout= "@layout/fragment_list_device_item"/>
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="0dp"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:layout_marginStart="16dp"-->
<!-- android:layout_marginEnd="16dp">-->
<!-- <include-->
<!-- android:id="@+id/layout_list_device"-->
<!-- android:layout_height="300dp"-->
<!-- android:layout_width="match_parent"-->
<!-- layout= "@layout/fragment_list_device_item"-->
<!-- />-->
</LinearLayout>
<!-- </LinearLayout>-->
<!-- <ImageView-->
<!-- android:id="@+id/img_bg_device_in_room"-->
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="60dp"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
......
......@@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/my_nav"
app:startDestination="@id/loginFragment">
app:startDestination="@id/homeManageFragment">
<fragment
android:id="@+id/loginFragment"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment