I'm beginning android programming slowly. I want to blank and white (page of all) theme .So I don't want to see this part of image.
image http://u1311.hizliresim.com/1h/m/upm9r.png
Add below line to your manifest application tag. It will remove from all activities and if you want to remove some of activity just copy and paste below code to activity tag.
android:theme="#android:style/Theme.NoTitleBar"
In your manifest, where the activity is declared, add the "android:theme" as below:
<activity
android:name="yourActivityName"
android:label="your label"
android:theme="#android:style/Theme.Holo.Light.NoActionBar.Fullscreen" >
</activity>
You may want to use this in your Activity
//Delete title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
Add this in your main activity:
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
Hope this helps.
In your manifest, in the activity tag, write so:
android:theme="#android:style/Theme.Holo.Light.NoActionBar"
Related
i want to change the app name. Not every where. only in the launcher screen of an android.
Not inside the app or in the installation screen.
is this possible?
Your Manifest.xml file should be similar to this:
<application
....
<activity
android:name=".activities.SplashScreenActivity"
android:label="myLabel"
android:screenOrientation="portrait"
android:theme="#style/SplashTheme">
....
....
As you can see every Activity node has a label attribute. Changing this changes only the activity label (not all over the application)
Set the android:label attribute of the main Activity in your Android Manifest (the one that starts when the Launcher icon is pressed)
I have a project in which i setted:
minSdkversion setted to 10
MainActivity is a TabActivity
Code in onCreate method is this:
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
...
With previous settings, all works well! But, if i set minSdkVersion to 11 or above, this exception occurs:
android.util.AndroidRuntimeException: You cannot combine custom titles with other title features
I don't understand why happens this just changing minSdkVersion.
I red a lot about this problem on this site. I tried setting:
Theme.NoTitleBar in main layout and after in Manifest file too
I put those 3 lines in all possible positions
If i comment first line a NullPointerException occurs when i call something on my TextView reference of my CustomTitle layout
I tried setting, in theme.xml file declaration, "windowNoTitle" = true
Since i'm using functions available from API 11 only, i want to set minSdk to 11 before loading App on Store. How can i do ?? I need Help
Edit: With minSdkVersion = 10 and Theme.NoTitleBar in Manifest, same error occurs. Removing it, all works as before.
Can anyone provide a working code (manifest and activity code) for setting a custom title when API is 11 or above ? Thx much
Fixed by my self. I don't know why, but simply adding in manifest file "theme" property for each activity's declaration, all works:
From this:
<activity
android:name=".CheckActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"
</activity>
To this:
<activity
android:name=".CheckActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:theme="#android:style/Theme" >
</activity>
#kinghomer I have tried CUSTOM_TITLE its on 2.2 (API 8) actually. Let me try on API 11 and get back to you!
Before that, you need not make Theme.NoTitleBar anywhere, can be controlled in .java file directly. Give me some time, will be back!
res/values-v11 defalut use this code :
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
change "android:Theme.Holo.Light" to "#android:style/Theme" will be ok!
tips: if your project no have "res/values-v11", then check your project referenced "lib project" 。
Other than the accepted answer ,there is another way to solve this :
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/CustomTheme" >
assign a theme attribution to application in the xml-based mainifest,that should work for all activities.
This problem occurs when you try to add a custom title bar along with extending your activity by ActionBarActivity or AppcomActivity. These two activity classes already have title bar defined.
So, when you try to add your own custom title bar a conflict arises, which title bar to use - your custom one or the one provided by activity extended.
To solve this issue, just extend your activity by Activity which does not have any predefined title bars, so yours will be accepted without any conflict.
public void MyActivy extends Activity
{
// your code
}
I just added android:theme="#android:style/Theme" in activity in AndroidManifest.xml file and it worked super fine.
<activity
android:name=".MainActivity"
android:theme="#android:style/Theme" >
</activity>
Hope this works for you as well.
In your AndroidManifest file, use this snippet instead of yours.
From this:
android:theme="#style/AppTheme">
to this:
android:theme="#style/custom_title">
I have a login screen with two EditTexts and a login button in my layout. The problem is that, when I start typing, the soft keyboard is shown and covers the login button. How can I push the layout up or above the keyboard when it appears?
I do not want to use a ScrollView, just want to implement it without scrolling down. How can that be done?
Set windowSoftInputMode property to adjustPan and adjustResize
<activity android:windowSoftInputMode="adjustPan|adjustResize"> </activity>
Try this in the android manifest file corresponding to the activity.
<activity android:windowSoftInputMode="adjustPan"> </activity>
Use this code in onCreate() method:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
only
android:windowSoftInputMode="adjustResize"
in your activity tag inside Manifest file will do the trick
Put this line in activity declaration time in manifest.xml
<android:windowSoftInputMode="adjustPan">
android:fitsSystemWindows="true"
add property on main layout of layout file and
android:windowSoftInputMode="adjustResize"
add line in your Manifest.xml file on your Activty
its perfect work for me.
I somehow achieved this by knowing the status of the soft keyboard on the device. i move the layout to y position when the keyboard is shown and moved back to its original position when not shown. this works fine, followed this guidelines.
Put this in your activity declaration in manifest file
<activity android:windowSoftInputMode="adjustPan|adjustResize"> </activity>
or if you want you can add in onCreate() method of your activity
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
This is all that is needed:
<activity android:windowSoftInputMode="adjustResize"> </activity>
I solve this by adding code into manifest:
<activity android:name=".Login"
android:fitsSystemWindows="true"
android:windowSoftInputMode="stateHidden|adjustPan"
</activity>
Accoding to this guide, the correct way to achieve this is by declaring in your manifest:
<activity name="EditContactActivity"
android:windowSoftInputMode="stateVisible|adjustResize">
</activity>
When the softkeyboard appears, it changes the size of main layout, and what you need do is to make a listener for that mainlayout and within that listener, add the code scrollT0(x,y) to scroll up.
If you are working with xamarin, you can put this code
WindowSoftInputMode =Android.Views.SoftInput.AdjustPan | Android.Views.SoftInput.AdjustResize in activity attribute of the MainActivity class.
For example, now the activity attribute will look like below
[Activity(WindowSoftInputMode =Android.Views.SoftInput.AdjustPan | Android.Views.SoftInput.AdjustResize)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
//some code here.
}
You should use
android:windowSoftInputMode="adjustPan|stateHidden"
in your AndroidManifest.xml file where you are declaring your activity. This will adjust your layout contents, when keyboard is shown in the layout.
Make use of Relative layout it will adjust the view so that you can see that view while typing the text
This works like a charm for me
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
This will definitely work for you.
android:windowSoftInputMode="adjustPan"
I am new to implement the ListView with section.
I have use this application to implement the section to my list view.
Now I want to add the Titlebar that display the application page title. Then where do I have to make a change? In the xml file or in the Java file?
Please refer the example and let me tell what should I have to change to make Titlebar for my app.
Try this...
final Activity activity = this;
activity.setTitle("Settings");
if you disabled the title bar using, this.requestWindowFeature(Window.FEATURE_NO_TITLE);
remove it.
(OR)
Try this..
final Activity activity = this;
this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.settings);
activity.setTitle("Settings");
There are two ways to change title bar for your activity:
Design time (that is, change title in AndroidManifest.xml file).
By coding (that is, you can code to change the activity title).
Example for 1st:
you can Change the Title of each screen (i.e. Activity) by setting their Android:label inside the AndroidManifest.xml file:
<activity android:name=".Hello_World"
android:label="This is the Hello World Application">
</activity>
And yes, to display customized title bar for your activity, go through this answer: How to change the text on the action bar
In your AndroidManifest.xml file you have a section for each activity that looks like this
<activity
android:label="Your Activity"
android:name=".YourActivity" />
where the android:label tag defines what the text in the titlebar is.
I have develop app in which I set layout 480 * 320, it is starting from top. But my problem is there is one in build border are display when we take a new project and it is display in all activity. So I want to disable it.
Border like
So can you tell how can I remove it or hide it?
I think what you are trying to do is hide the TitleBar of the application. You can do that by changing the application theme.
Add android:theme="#android:style/Theme.Light.NoTitleBar" in the <application> tag of your manifest file.
Any theme with .NoTitleBar should do the trick.
use any one.
Manifest:
android:theme="#android:style/Theme.NoTitleBar"
Or
java:
requestWindowFeature(Window.FEATURE_NO_TITLE);
requestFeature(FEATURE_NO_TITLE);
in you activity's onCreate before setting the layout should remove it.
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);