The built-in display of a phone in an Android application is not just a decorative element, but a powerful tool for demonstrating functionality, training users, or creating a unique visual style. For example, instant messengers often show smartphone mockups to simulate chats, banking applications - to display virtual cards, and educational platforms - to simulate working with a device. But how to do this aestheticallyso that the interface does not look overloaded, and the animations work smoothly even on weak devices?
In this article we will look at 10 proven ways the design of the phone inside Android apps - from static SVG images to dynamic 3D models with gesture support. We will pay special attention optimizing performance: for example, why using Lottie to animate a phone can reduce FPS by 30% on devices with Adreno 505, and how to avoid this. We will also provide a comparative table of libraries for rendering 3D models (Rajawali, Filament, Sceneform) indicating their compatibility with modern versions of Android.
The material will be useful as designersand developers: the former will learn about visualization trends (for example, neomorphism for phone layouts in 2026), and the latter will receive ready-made code snippets for integration. All examples have been tested on Android 14 and Android 15 Developer Preview, taking into account the features of new Material You topics.
1. Static images vs. vectors: what to choose for a phone layout
Let's start with the basic approach - using raster (PNG/JPEG) or vector (SVG/Vector Drawable) images a phone. Raster images are suitable for fixed resolutions, but lose quality when scaled. Vectors, on the contrary, adapt to any screen, but can slow down with complex gradients.
Key selection criteria:
- ๐ฑ Screen resolution: for
xxhdpi(1080p) PNG 500ร1000 px is enough, forxxxhdpi(1440p) โ 700ร1400 px. - ๐จ Complexity design: if the phone has transparency (for example iPhone 15 with a titanium case), SVG is preferable.
- โก Performance: vector animations (
AnimatedVectorDrawable) consume 15-20% more CPU than static PNGs.
Example of vector integration in XML:
<vector android:name="phone_mockup" android:width="300dp" android:height="600dp"xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF0000" android:pathData="M10,10 L290,10 L290,590 L10,590 Z"/>
<path android:fillColor="#FFFFFF" android:pathData="M20,20 L280,20 L280,580 L20,580 Z"/>
</vector>
โ ๏ธ Attention: When using SVG cImageViewviaapp:srcCompaton Android 9 and below, artifacts may occur when scaling. Test on an emulator with API 28.
2. Interactive layouts: handling clicks on a โvirtualโ phone
A static phone in the interface is boring. It is much more effective to make it clickableso that the user can interact with elements on the mockup screen. For example, in an application for learning to work with Samsung Knox you can simulate unlocking a phone or setting up security.
This can be implemented in two ways:
- Overlay with
FrameLayout: invisible ones are overlaid on top of the phone imageView(for example,Buttonsbackground="@android:color/transparent"), which process clicks. - Custom
View: draw the phone inonDraw()and track touches throughonTouchEvent().
Example code for the second approach:
class InteractivePhoneView(context: Context, attrs: AttributeSet) : View(context, attrs) {private val phoneRect = RectF(100f, 200f, 800f, 1200f) // Phone coordinates
private val screenRect = RectF(120f, 220f, 780f, 1180f) // Screen coordinates
override fun onDraw(canvas: Canvas) {
// Drawing the phone body
canvas.drawRoundRect(phoneRect, 50f, 50f, Paint().apply { color = Color.BLACK })
// Drawing the screen
canvas.drawRect(screenRect, Paint().apply { color = Color.WHITE })
}
override fun onTouchEvent(event: MotionEvent): Boolean {
if (event.action == MotionEvent.ACTION_DOWN && screenRect.contains(event.x, event.y)) {
// Handling a click on the phone screen
performClick()
return true
}
return super.onTouchEvent(event)
}
}
โ ๏ธ Attention: When When usingFrameLayoutwith overlays, make sure that clickable elements haveandroid:clickable="true"iandroid:focusable="true"installed. Otherwise, events will not be transmitted.
โ๏ธ Checking the interactive mockup
3. Phone Animations: Lottie, Property Animation and MotionLayout
Phone animation can greatly improve the user experience. For example, smooth mockup appearance when loading or rotate the device when changing orientation. Let's look at three popular tools:
| Tool | Pros | Cons | Best for |
|---|---|---|---|
| Lottie | Easy integration, support for After Effects | Heavy animations lag on weak devices | Simple 2D animations (for example, screen blinking) |
Property Animation |
Native approach, high performance | Difficult to implement complex movements | Rotations, scaling, alpha channel |
| MotionLayout | Declarative syntax, support for transitions | Learning curve, limited documentation | Complex transitions between states (for example, turning a phone) |
An example of an animation of turning a phone using ObjectAnimator:
val phoneView = findViewById<ImageView>(R.id.phone_mockup)val animator = ObjectAnimator.ofFloat(phoneView, "rotationY", 0f, 360f).apply {
duration = 2000
interpolator = AccelerateDecelerateInterpolator()
}
animator.start()
For smooth animation in Lottie, reduce the number of key frames in After Effects and export with the "Reduce Keyframes" setting. This will reduce the JSON file size by 40โ50%.
4. 3D phone models: Rajawali, Filament and Sceneform
If you need realistic 3D model of the phone (for example, for an AR application or repair simulator), consider specialized libraries. They allow you to render the device with texture, lighting and even physics.
Library comparison:
- ๐น Rajawali: outdated, but supported
OpenGL ES 2.0/3.0. Suitable for simple 3D scenes. - ๐น Filament: from Google, optimized for mobile devices. Supports
VulkanandPBR materials. - ๐น Sceneform: simplifies work with ARCore, but requires Android 7.0+.
An example of loading a 3D model of a phone into Filament:
// 1. Initializing the engineval engine = Engine.create()
val scene = engine.createScene()
// 2. Loading the model (glTF format)
val asset = AssetLoader.create(engine, context.assets.open("phone.glb"))
val entity = asset.getEntities()[0]
// 3. Adding to the scene
scene.addEntity(entity)
// 4. Rendering in SurfaceView
val renderer = MobileRenderer(scene)
val surfaceView = findViewById<SurfaceView>(R.id.surface_view)
surfaceView.setRenderer(renderer)
โ ๏ธ Attention: 3D models increase the APK size. For Sceneform the minimum increase is 10 MB (due to dependencies ARCore). UseabisSplittobuild.gradleto reduce the size for specific architectures.
How to optimize a 3D model for Android?
1. Reduce the polygon count in Blender (goal: <50k for phone). 2. Convert textures to ASTC or ETC2. 3. Use LOD (Level of Detail) for distant objects.
5. Dynamic display of content on the phone screen
Often required the phone screen in the mockup displayed real data from the application. For example, in a banking application, a mockup can show the user's account balance. Suitable for this:
- ๐ฒ
TextureView: allows you to render anyVieworSurfacetexture. - ๐ผ๏ธ
Canvas+Bitmap: draw the content manually and apply it as texture. - ๐ WebView: if the content is dynamic and loaded from the server (for example, a web version of a chat).
Example with TextureView:
<TextureViewandroid:id="@+id/phone_screen"
android:layout_width="250dp"
android:layout_height="500dp"
android:layout_marginStart="25dp"
android:layout_marginTop="50dp"/>
// In codeval textureView = findViewById<TextureView>(R.id.phone_screen)
val surfaceTexture = textureView.surfaceTexture
val surface = Surface(surfaceTexture)
// Draw on Surface via Canvas or render View
val canvas = surface.lockCanvas(null)
canvas.drawColor(Color.WHITE)
canvas.drawText("Balance: 10,000 โฝ", 50f, 50f, Paint())
surface.unlockCanvasAndPost(canvas)
For dynamic content on the mockup screen, use TextureView + Surface. This gives better performance than WebView, but requires manual control of rendering.
6. Adaptability: how the phone in the application looks on different screens
The phone mockup should be displayed correctly on all devices - from Galaxy Fold (folding screen) to Pixel 8 (high aspect ratio). To do this:
- Use
ConstraintLayoutto position the mockup relative to other elements. - Set dimensions in
dp, not inpx, and limit the maximum width/height. - For foldable devices, check
Configuration.ORIENTATIONandConfiguration.SCREENLAYOUT_SIZE_MASK.
An example of a responsive layout:
<androidx.constraintlayout.widget.ConstraintLayoutxmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/phone_mockup"
android:layout_width="0dp"
android:layout_height="0dp"
android:src="@drawable/phone_vector"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintWidth_max="400dp"
app:layout_constraintHeight_max="800dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
For foldable devices, add a check in the code:
val isFoldable = resources.configuration.screenLayout andConfiguration.SCREENLAYOUT_SIZE_MASK == Configuration.SCREENLAYOUT_SIZE_XLARGE
if (isFoldable) {
// Setting up the layout for foldable screen
phoneMockup.layoutParams.width = 600 // Increase the size of the mockup
}
7. Performance optimization: how to avoid lags
A poorly optimized phone mockup can reduce FPS the entire application, especially if it is animated or contains 3D. Main problems and solutions:
| Problem | Cause | Solution |
|---|---|---|
| Lags when scrolling | Complex VectorDrawable or Lottieanimations |
Replace with raster or simplify paths in SVG |
| Long loading | 3D model with a high-poly mesh | Use glTF with LOD or reduce polygons |
| Freezes during interaction | Frequent redraws TextureView |
Limit FPS to 30 for dynamic content |
For diagnostics, use Android Profiler in Android Studio:
- Open
CPU Profilerand check the loading when interacting with the mockup. - in
Memory Profilermonitor leaks when working withBitmapor 3D textures. - Turn on
GPU Overdrawto Developer Optionsto find redundant layers.
If the phone mockup is only used on one screen, download its resources (textures, models) lazily using Glide or Coil, and do not include it in the main APK.
8. Trends 2026: neomorphism, sceumorphism and minimalism
In 2026, the design of phone mockups in Android applications follows three main trends:
- ๐จ Neomorphism: soft shadows and convex elements that imitate physical objects. Suitable for educational applications.
- ๐ฑ Skeumorphism: realistic textures (metal, glass) for device simulators.
- โช Minimalism: flat icons without shadows, emphasis on screen content (for example, in Google Messages).
Implementation examples:
- For neomorphism use
CardViewscardElevation="8dp"icardBackgroundColor="#F0F0F0". - For skeumorphism connect textures via
shapeableImageViewsapp:strokeColor="#808080".
Color palettes of 2026 for mockups:
- ๐ฃ Purple:
#6E5EF5(used in Material You for a dark theme). - ๐ข Mint:
#A7E8BD(popular in fitness applications). - โซ Graphite:
#333333(for corporate applications).
โ ๏ธ Attention: Design trends may change. Before making the final choice of style, check the current guidelines Material Design on the official Google website.
FAQ: Frequently asked questions about designing a phone in Android
How to make a phone mockup clickable only in the screen area?
Use Canvas i Region to determine the clickable zone:
val screenRegion = Region()screenRegion.set(120, 220, 780, 1180) // Screen coordinates
override fun onTouchEvent(event: MotionEvent): Boolean {
val x = event.x.toInt()
val y = event.y.toInt()
if (screenRegion.contains(x, y)) {
// Click processing
return true
}
return super.onTouchEvent(event)
}
Which library is better for a 3D model of a phone on weak devices?
Filament shows the best performance on Mali-G72 and Adreno 610 thanks to optimization for Vulkan. For comparison:
- Rajawali: 45 FPS on Redmi 9 (Snapdragon 662).
- Filament: 58 FPS on the same device.
How to animate the change of content on the mockup screen?
Use TransitionManager for a smooth transition:
TransitionManager.beginDelayedTransition(container)phoneScreenView.visibility = View.GONE
newContentView.visibility = View.VISIBLE
For complex animations (for example, scrolling a chat) connect RecyclerView inside TextureView.
Is it possible to use WebView to display the phone screen?
Yes, but this is not optimal:
- โ Pros: easy integration, JS support.
- โ Cons: high memory consumption (30% more than that
TextureView), lags when scrolling.
Alternative: rendering via SurfaceView + Canvas.
How to test a mockup on different versions of Android?
Create AndroidTest using Espresso:
@Testfun testPhoneMockupVisibility() {
onView(withId(R.id.phone_mockup)).check(matches(isDisplayed()))
onView(withId(R.id.phone_screen)).check(matches(hasContentDescription("Phone screen")))
}
For visual testing, use Screenshot Tests in Android Studio Giraffe.