Component Name | Class Name | Description |
Gift Selection Panel | GiftListView | Shows the available gifts and handles user selection and sending actions. |
Gift Animation Display | GiftPlayView | Receives gift messages and renders animations (e.g., SVGA) on screen. |
Gift Panel | Live Comment Gifts | Full-Screen Gifts |
![]() | ![]() | ![]() |
GiftListView is typically presented as a popup or bottom panel. Add it to your Activity or Fragment layout as shown below.import android.os.Bundleimport android.widget.FrameLayoutimport androidx.appcompat.app.AppCompatActivityimport com.trtc.uikit.livekit.Rimport com.trtc.uikit.livekit.component.gift.GiftListViewclass YourLiveActivity : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)setContentView(R.layout.activity_live_room)// Get the root layout containerval rootView = findViewById<FrameLayout>(R.id.root_view)// 1. Create the gift list componentval giftListView = GiftListView(this)// 2. Initialize the component with the current Room ID// Note: Make sure you have a valid roomId at this pointgiftListView.init("your_room_id")// 3. Add the component to the view hierarchyrootView.addView(giftListView)}}
GiftPlayView is a transparent overlay for gift animations. Place it above the video layer and below your interactive controls.import android.os.Bundleimport android.widget.FrameLayoutimport androidx.appcompat.app.AppCompatActivityimport com.trtc.uikit.livekit.Rimport com.trtc.uikit.livekit.component.gift.GiftPlayViewclass YourLiveActivity : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)setContentView(R.layout.activity_live_room)val rootView = findViewById<FrameLayout>(R.id.root_view)// 1. Create the gift playback componentval giftPlayView = GiftPlayView(this)// 2. Initialize the component with the current Room ID// The component will automatically listen for gift messages in this room and play animationsgiftPlayView.init("your_room_id")// 3. Add the component to the view hierarchy// Recommended: Add this View above the video layer and below UI controlsrootView.addView(giftPlayView)}}
Feedback