How to remove full screen mode in android app - java

I am new in android app development I didn't declare anything for full screen mode still it asks in bottom of my application during runtime for full screen mode only for device with small screen like redmi 6A Here is output
Its just a demo app to ask for permission like call , contacts etc it works fine without crashing just i want to remove that option for full screen from bottom of the screen
would really be great full if anyone can guide
Thanks in advance
UPDATE
permission_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<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="com.android.dialer.PermissionActivity">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true">
</LinearLayout>
</RelativeLayout>

Related

Cannot resolve dimensions in main_activity.xml

I'm following a tutorial to help me build a 2D game - https://www.simplifiedcoding.net/android-game-development-tutorial-1/#Planning-the-Game-Story
The tutorial tells me to add the following code:
<?xml version="1.0" encoding="utf-8"?>
<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"
android:background="#drawable/splash"
tools:context="net.simplifiedcoding.simplegame.MainActivity">
But I'm getting cannot resolve errors on the following:
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
I've tried ALT+Enter to create a dimen.xml file, but I'm not sure what to even put when doing this and my app will not compile.
Do not have the dimen file
You must create one and place the data in your educational video
Or change the code to this:
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
Put the number in the tutorial video you're following to get the correct numbers instead of the written number 0
Okay I figured it out, I hit ALT+ENTER to create a dimen.xml file, I then put the value as 0dp for each.

Android: Adding a VectorDrawable to an ImageView

So, I wanted to make a scroll-able worldmap with clickable countries. So when I found out there was a thing like VectorDrawables, I decided to give these a try.
Next thing I did was making a VectorDrawable xml file out of a SVG and tried to put it in my ImageView. While searching for some info, I found out that there were 101 ways to do this, and none of them worked for me...
The interesting thing is that, when I add "android:src="#raw/worldmap" in the ImageView in my activity.xml, the map shows up in the preview, but whenever I try to run the app, it crashes.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:id="#+id/activity_show_hint"
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="com.example.bert.myapplication.ShowHintActivity"
android:weightSum="1">
<ImageView
android:id="#+id/img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:scaleType="center"
android:src="#raw/worldmap">
</ImageView>
</LinearLayout>
First, move your VectorDrawable to Drawable folder (not in raw). and then, add this line in your Gradle file :
defaultConfig{
vectorDrawables.useSupportLibrary = true
}
And finally, in your imageView, change to this;
<ImageView
android:id="#+id/img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:scaleType="center"
app:srcCompat="#drawable/worldmap">
</ImageView>

Android Studio: ImageView not showing

I´m new in Java and Android Studio and tried to use a png in my test-application.
Since I own a AMD processor I have to use my real device (Galaxy S6) to run it. Strangely, the Image that I used shows up in Android Studio, plus it´s in the right size. Anyways, it´s not showing up on my device, theres only the white background.
Code: (content.main.xml)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
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"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.example.chris.startbildschirm.MainActivity"
tools:showIn="#layout/activity_main">
<ImageView
android:layout_width="300dp"
android:layout_height="300dp"
android:id="#+id/imageView"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:src="#drawable/logo"/>
</RelativeLayout>

Android splash screen not appearing correctly

When the app is loading, instead of a proper splash screen it just shows, the best way to describe it, when you go to install an app from the Play store, the black screen with the icon in the top left corner and some text, that's all it shows when launching my app...
I narrowed it down to activity_game.xml as when looking in the Graphical Layout of that file, it just shows a boring black screen with text.
How would I change this to incorporate a full screen image on splash instead?
Let's say for example, the image is called 'loading.png'
Content of activity_game.xml is below;
<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=".GameActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_world" />
</RelativeLayout>
--- Edit -
Thanks Rod, works to the point I now get a black screen on launch, I copied loading.png into the drawable folder and use the code like this;
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context=".GameActivity" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/loading"
android:adjustViewBounds="true"
android:scaleType="fitXY" />
</RelativeLayout>
Not sure why it is not loading the image?
First you need to make your activity full screen by setting the theme to no title bar into your activity tag of the manifest and add this:
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
Dont add padding to the RelativeLayout to avoid the black screen border, instead of TextView use the ImageView to create an image to the layout.
sample:
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context=".GameActivity" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="your_drawable_image"
android:adjustViewBounds="true"
android:scaleType="fitXY" />
</RelativeLayout>

Android Emulator still showing Hello World

So I've set up my Eclipse to have the Android SDK and ADT plugin.
I set up my AVD to have a Galaxy Nexus and Galaxy S2 emulator.
I've created a new Android project and I get my blank MainActivity which simply displays "Hello World!" which is the problem.
In the Graphical Layout, I delete the "Hello World!" text to remove it. I check in the activity_main.xml and the script containing the "Hello World!" text is no longer there. I run in either emulator and everything works, but when the app opens, "Hello World!" is still there.
Here's the xml now
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.project.MainActivity"
tools:ignore="MergeRootFrame" />
I've changed nothing except removing that text. The MainActivity.java has not been touched. Is there something I'm missing?
This was a little bit odd when it happened to me, just remove the Hello World Text View from the fragment.xml file and it should be fine.
that xml code is just for layout when you add smthg on layout this code will be bigger,example
<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=".MainActivity" >
<Button
android:id="#+id/bb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/editText1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="72dp"
android:text="git" />
thats have only a button
your code has nothing only layout

Categories