[英]Creating custom looking android activity
I have seen certain apps in play store that doesn't take full screen like the normal activities do. 我在Play商店中看到某些应用无法像正常活动那样全屏显示。 They take a portion of screen. 他们占据了屏幕的一部分。 I have tried to search a solution but as I am newbie, I don't know the exact words that are used for such kind of activities. 我已经尝试搜索解决方案,但是由于我是新手,所以我不知道用于此类活动的确切字词。 How can I create such activities? 如何创建此类活动? Regards 问候
These are using Transparent Activity
. 这些正在使用Transparent Activity
。 You can kind how to create transparent activities here and here . 您可以在此处和此处介绍如何创建透明活动。
For example 例如
You could apply a transparent theme to the required activity. 您可以将透明主题应用于所需的活动。 Create a new style in /res/values/style.xml
在/res/values/style.xml
创建新样式
<resources>
<style name="iosTransparent">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
</resources>
Now Apply theme 现在申请主题
<activity android:name="IosNotActivity" android:theme="@style/iosTransparent"></activity>
Make a layout like this (it is just a sample) 进行这样的布局(仅作为示例)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/opLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="bottom">
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/ios"
android:scaleType="fitXY"/>
</LinearLayout>
Gives output like this(this is scaled since i used just an image, you can use any layout you want) 给出这样的输出(由于我仅使用图像,因此可以缩放,可以使用所需的任何布局)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.