Component Name | Class Name | Description |
Gift Selection Panel | GiftListView | Displays a list of gifts, handles user selection, and manages gift sending events. |
Gift Playback Component | GiftPlayView | Receives gift messages and renders corresponding animation effects (such as SVGA animations) on screen. |
Gift Panel | Live Comment Gifts | Full-Screen Gifts |
![]() | ![]() | ![]() |
GiftListView component is typically displayed as a popup or bottom panel. Add it to the layout of your Activity or Fragment.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 container for the pageval rootView = findViewById<FrameLayout>(R.id.root_view)// 1. Create an instance of the gift list componentval giftListView = GiftListView(this)// 2. Initialize the component with the current Room ID// Note: Ensure you have a valid roomId before initializinggiftListView.init("your_room_id")// 3. Add the component to the view hierarchyrootView.addView(giftListView)}}
GiftPlayView is a transparent overlay that displays gift animations. It should be positioned above the video layer and below the 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 an instance of the gift playback componentval giftPlayView = GiftPlayView(this)// 2. Initialize the component with the current Room ID// The component automatically listens for gift messages in this room and triggers playbackgiftPlayView.init("your_room_id")// 3. Add the component to the view hierarchy// We recommend adding this View above the video layer and below the UI controlsrootView.addView(giftPlayView)}}
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários