SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 79 in 17 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //activity_root.xml
  2. <?xml version="1.0" encoding="utf-8"?>
  3. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4.     android:id="@+id/content"
  5.     android:layout_width="match_parent"
  6.     android:layout_height="match_parent">
  7. </FrameLayout>
  8.  
  9.  
  10. //fragment_splash.xml
  11. <?xml version="1.0" encoding="utf-8"?>
  12. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  13.     android:id="@+id/frag_splash"
  14.     android:layout_width="match_parent"
  15.     android:layout_height="match_parent">
  16.  
  17.     <ImageView
  18.         android:layout_width="match_parent"
  19.         android:layout_height="match_parent"
  20.         android:src="@drawable/splash"
  21.         android:scaleType="centerCrop"/>
  22.  
  23. </FrameLayout>
  24.  
  25.  
  26. //AppActivity.kt
  27. package ru.skillbranch.gameofthrones
  28.  
  29. import android.os.Bundle
  30. import androidx.fragment.app.FragmentActivity
  31. import ru.skillbranch.gameofthrones.ui.splash.SplashFragment
  32.  
  33. class AppActivity : FragmentActivity() {
  34.  
  35.     override fun onCreate(savedInstanceState: Bundle?) {
  36.         super.onCreate(savedInstanceState)
  37.         setContentView(R.layout.activity_root)
  38.         supportFragmentManager.beginTransaction().add(R.id.content, SplashFragment()).commit()
  39.     }
  40. }
  41.  
  42.  
  43. //SplashFragment.kt
  44. package ru.skillbranch.gameofthrones.ui.splash
  45.  
  46. import android.os.Bundle
  47. import android.view.LayoutInflater
  48. import android.view.View
  49. import android.view.ViewGroup
  50. import androidx.fragment.app.Fragment
  51. import ru.skillbranch.gameofthrones.R
  52.  
  53. class SplashFragment: Fragment() {
  54.     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
  55.         val root = inflater.inflate(R.layout.fragment_splash, null)
  56.         return root
  57.     }
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top