How to get a truly blank vanilla app with eclipse - android

I have made several apps before using eclipse. I (think) always started out with file>new>project>application project and eclipse set up a project in which the main activity was comprised of a black screen with nothing in it - until I used the "graphical layout" editor to start adding some buttons/text etc.
But in more recent versions of eclipse it appears that however hard I try, I always seem to ens up with some components already on my activities screen. It appears that some "style" or "theme" (whatever they are) has been selected in the process and my activity starts with a fat bar across the top with my application's icon on the left of it. I have attempted to make edits to various xml files to remove the unwanted icon/bar, but so far to no avail.
What do I need to do to get a properly blank application so that I can be fully in charge of every pixel on the screen?

In your graphical layout preview select AppTheme select theme select Theme.NoTitleBar.FullScreen
You should see a preview with no title bar
Add this in manifest for your activity
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">

Related

cordova/phonegap has quick loading screen on android

When ever I load my app on android I get a grey screen with the words "player needed"(the apps name) across the top for about a second before my app actually starts. It does not appear on the development testing app only when I do an actual build, and then only when I start the app. If I change windows back and forth it does not appear again. How can I remove this?example of grey screen
Thank you!
You could try this, worked for me, it's something about the MainActivity theme on Android.
In the "platforms\android" folder under your project, open the AndroidManifest.xml and search for android:theme inside the <activity> tag that contains android:name="MainActivity" and change the default value (that is android:theme="#android:style/Theme.DeviceDefault.NoActionBar") to android:theme="#android:style/Theme.Translucent". Save the file and build your project again, the grey screen should desapear.

How can I get the ActionBar to render?

I'm a new to Android development and I've been giving Android Studio a spin. I've followed Google's tutorial and I still haven't been able to get the ActionBar up and running either on the emulator or on the real device. I've specified the min version in the manifest file and I've also edited the menu and activity xml files accordingly.
Confusingly, the UIs shown in the activity_foo.xml and menu_foo.xml are different:
activity_foo.xml:
menu_foo.xml:
Even more confusingly, the final app when built shows both the Search and Settings in the hamburger menu though I do not recall seeing it in the GUI previews:
How can I fix this?
Confusingly, the UIs shown in the activity_foo.xml and menu_foo.xml are different
They are supposed to be different. One is showing you a layout file. The other is showing you a menu resource. Their previews are not supposed to necessarily match. After all, an Android app that is bigger than a breadbox will have many layout resources, few of which will be defining the contents of an activity.
For those layouts that do define the contents of an activity, IIRC, you can have the same tools:context=".FooActivity" in the root element of your layout file, and the preview may take that into account.
Even more confusingly, the final app when built shows both the Search and Settings in the hamburger menu though I do not recall seeing it in the GUI previews:
In the preview, the search item is represented by a toolbar-style button (icon is a magnifying glass).
In your menu resource, you have one <item> that has android:showAsAction and one <item> that has app:showAsAction. Either you are using the appcompat-v7 action bar backport, or you are not. That would be determined by things like:
what Java class your activity inherits from (ActionBarActivity or AppCompatActivity for appcompat-v7)
what theme you are using for the activity in your manifest (if it is based on Theme.AppCompat.*, you are using appcompat-v7)
If you are using appcompat-v7, you need to change the android:showAsAction to app:showAsAction. Given the results of your run of the project in the emulator, my guess is that you are using appcompat-v7. If you make the change to the menu resource and run the project again, you may see the search item show up as the magnifying glass icon, as you see in the preview. I say "may" because there may or may not be room to show that toolbar-style icon, depending on screen size and orientation of the device that runs your app — action bar items with ifRoom will show as toolbar-style buttons if there is room or will fall into the overflow menu if not.

Unable to create a ToggleButton in Eclipse IDE for android

In my android XML Graphical Layout, it can not display my ToggleButton. I get some errors (see below). I have checked all other components in the Palette window and the only component that fails to load is ToggleButton. The problem is not project specific. It persists in every project I create.
Note: I have tried dragging it directly as well as using XML code to generate it. But it fails either way and the error is same.
Error :
Exception raised during rendering: -1
Exception details are logged in Window > Show View > Error Log
The graphics preview in the layout editor may not be accurate:
Different corner sizes are not supported in Path.addRoundRect. (Ignore for this session)
Path.isConvex is not supported. (Ignore for this session)
I have referred this question and tried to edit it but the edit was rejected. So please do not redirect me there.
I am using API 21. All the build tools are installed.
I had the same problem and solved by changing my target device screen to any of the xhdpi OR xxhdpi devices.
I'm sorry but I'm not able to post images yet, all you have to do is go to the dropdown menu just above the graphical layout -> General OR Google -> Select the xhdpi/xxhdpi target device you prefer.
I'm also new to android so I'm not able to explain why this is happening, I can only guess it's a compatibility issue or something. I'll try finding out more..
In the meantime I hope this will turn useful for you as well :-)
Problem is in your background drawable. Corners of your rectangle can be rounded all only by a same amount. Just like your error message says. You must set them all to same amount.
Perhaps it is the display theme so ensure that the theme you select matches the android:theme in your activity tag in AndroidManifest.xml. In Android Studio (sorry not eclipse as per question) in the top bar of the preview panel, I had to click the current theme name (which was Light) which brings up the Select Theme panel and then choose my theme under Project Themes (as I had a custom theme - you location may vary).

Android custom view shows up even if all source files are deleted

Using SherlockActionBar I wrote a custom actionProviderClass (a spinner) for one of the action bar items.
I decided I don't need it and deleted all the files for it as well as the actionProviderClass attribute in the menu file. I even removed the spinner's values from strings.xml.
However, if I switch to horizontal orientation, the damn thing still shows up. I tried a fresh emulator as well as a device and it still happens. I also cleaned the project in Eclipse.
I guess something is being cached somewhere, anyone have any ideas?
User error here.
SherlockActionBar will collapse tabs into a spinner sometimes even though there is space for views

Removing Android Status Bar in Eclipse's Graphical Layout

How do I remove the android emulator's Status Bar inside Eclipse's Graphical Layout? My application is set to run in full screen mode, but I'm having a hard time in layouting because the status bar is present in the graphical layout of Eclipse.
You can just change the theme in the drop-down list (or perhaps better said in Android terminology: Spinner :)) at the top right corner in the layout editor to one of the *.NoTitleBar.Fullscreen options.
Edit: added screenshot.
By the way, if you have a hard time creating layouts that properly scale with or without the titlebar/actionbar, you may have to rethink if you're going down the right path. If you're developing for a specific (number of) device(s), then I haven't said anything.
you can select the theme spinner and select the "Theme.NoTitleBar.Fullscreen".
Using code:-
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
above written code placed in oncreate method
I had the same problem. In debugging process, my graphical layout was perfect on the Eclipse but not correct on my phisycal device because of the statu bar at the bottom of the graphical layout on Eclipse.
I resolved this problem modifying the Theme of the layout inside eclipe and choosing "SearchBar", as shown in the pictures below. I hope to solve this question.
See the setting on Eclipse

Categories

Resources