This is the result of my application.
This android application can be updated with your features when you need to see the background.
For example a simple clock or something else.
First, you need to create one default android project.
This will make all your files to working like one simple android application.
Now the changes come with this file ( AndroidManifest.xml) :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.free_tutorials.catalin.myclock" > <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/Theme.Transparent" > <activity android:name=".MyClock" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> |
The changes from MyClock.java:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | package com.free_tutorials.catalin.myclock; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import static android.R.layout.*; public class MyClock extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_clock); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_my_clock, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } |
Another file you need to change it – activity_my_clock.xml.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MyClock"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="MyClock" /> </RelativeLayout> |
… the styles.xml file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> </style> <style name="Theme.Transparent" parent="android:Theme"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowContentOverlay">@null</item> <item name="android:windowNoTitle">false</item> <item name="android:windowIsFloating">false</item> <item name="android:backgroundDimEnabled">false</item> </style> </resources> |
Most users got some errors with R.layout. …
This error comes when you did not set the correct settings of Android Studio.
So try to add your Project Settings the correct dependencies:
Errors can be annoying, but if you know everything that happens in Android Studio you managed to solve it.