一个Android屏幕有三种类型的瓷砖(three types of tiles for one Android screen)

编程入门 行业动态 更新时间:2024-10-25 20:25:24
一个Android屏幕有三种类型的瓷砖(three types of tiles for one Android screen)

我想使用三种重复的瓷砖作为一个Android屏幕的背景。 以下是我想要达到的最终结果。

可以在Android中完成吗?

I want to use three kinds of repeating tiles as background for one Android screen. The following is what I want to achieve as an end result.

Can it be done in Android?

最满意答案

在drawable文件夹中创建一个xml,并使用以下代码

<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/YOUR_IMAGE android:antialias="true" android:dither="false" android:filter="false" android:gravity="fill" android:tileMode="repeat" />

然后将此文件设置为您的背景。 :)

Creating three layouts inside the main layout achieves the design.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".SplashActivity" > <RelativeLayout android:layout_width="match_parent" android:layout_height="1dp" android:layout_weight="4" android:background="@drawable/woodentile" > </RelativeLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0sp" android:layout_weight="1" android:background="@drawable/woodenshadowtile" > </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0sp" android:layout_weight="1" android:background="@drawable/papertile" > </LinearLayout> </LinearLayout>

You need three bitmap files in the drawable folder. I will show woodentile.xml as an example.

<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:dither="true" android:src="@drawable/inno_luck_wood_pattern_background" android:tileMode="repeat" > </bitmap>

That's it. Doing this results in the kind of design that I want to create.

更多推荐

Android,want,屏幕,电脑培训,计算机培训,IT培训"/> <meta name="description&q

本文发布于:2023-08-07 13:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464708.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:瓷砖   有三种   屏幕   类型   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!