Android PreferenceActivity wiered behaviour - android

In my application Preference Setting Activity is not showing correctly sometimes. It goes black.
My Original Preference Activity
But sometimes it goes black and shows as below screenshot
no check boxes and list preference are visible.
When it goes black and I scroll It looks very poor
The Declaration in Manifest file
<activity
android:name="com.test.wallpaper.PreferenceSettingActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>

You have need to set Background for parent layout in this xml page.
Use setbackground for parent layout in xml.

Related

windowSoftInputMode=“adjustResize” doesn't work in my Activity

I have form-like editTexts and my softkeyboard is overlapping editText field. In my FragmentActivity I just set windowSoftInputMode=“adjustResize” in my AndroidManifest (or in onCreate()) and it works. But in my regular Activity I set this and it doesnt work at all.
I cant set android:fitsystemwindow="true" because it will destroy my layout with transparent statusBar and not transparent navigationBar.
AndroidManifest
<activity
android:name=".ProfilePackage.EditProfile.EditProfileActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
android:label="#string/app_name">
</activity>
<activity
android:name=".Activities.CommentActivity"
android:windowSoftInputMode="adjustPan" />
I had the same Problem where the Softkeyboard was covering other views. So I added this line in manifest.

Android : Scroll Screen when keyboard showing using ConstraintLayout

I am using android.support.constraint.ConstraintLayoutwith four EditText and one Button. When clicked on First Edittext, SoftInput Keyboard visible then EditText and Button Hidden.
I tried in ManiFeast.xml
android:windowSoftInputMode="adjustResize"
android:windowSoftInputMode="adjustPan"
android:windowSoftInputMode="adjustResize|stateVisible"
But did work.
Any suggestion to make screen scrollable when not using ScrollView
its my Manifest.xml Activity tag
<application
.
.
.
<activity android:name=".MainActivity"
android:windowSoftInputMode="adjustResize|stateVisible"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
There is no way to tell when the keyboard is showing. So what you want isn't possible. What you can do is stick the whole thing in a ScrollView so its always scrollable. Then it will still be scrollable when the keyboard is up.

softInputMode in fragments

I have a NavigationDawer with some fragments which contain EditTexts. When I 'open' the fragment, the layout is fine (ie. not squashed) but when I bring the keyboard up, the layout becomes squashed.
I searched around and added this to the manifest:
<activity
android:name=".Navigation_Drawer"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize" > // This being the important part
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Because the Navigation Drawer is the only activity that contains/starts these fragments, the fragment's softInputMode should be controlled by the activity, but this code does not make any difference
Thank you
Remove the code:
android:windowSoftInputMode="adjustResize"
from manifest file.
Have you tried setting the windowSoftInputMode to adjustPan?
adjustResize will resize the activity to allow room for the keyboard, which is the behaviour you are experiencing. If you set the windowSoftInputMode to adjustPan, the activity will be be 'panned', or moved upwards to make room for the keyboard.
android:windowSoftInputMode="adjustPan"

Running the Android app without TitleBar

As by default, the application name is appearing on one label like TextView. How do i remove my titlebar permanently for my application?
Any ideas?
You can use below code for that -
<activity android:name="YourActivityname" android:theme="#android:style/Theme.NoTitleBar" />
If you want the full screen of your device you can use below code -
<activity android:name="YourActivityname" android:theme="#android:style/Theme.NoTitleBar.Fullscreen" />
And, also refer Developer's Site
That is a setting based on the activity in your android manifest file.
Use the No Title Bar theme for your activity.
<activity android:name="MyActivityName" android:theme="#android:style/Theme.NoTitleBar" />

Android -- How to disscociate the name of the application from the titlebar?

I added a custom title-bar to an android application and this titlebar (which is a plain png) shows up inside the main activity. The problem is that the main activity also defines the name of the application using the label tag like this:
<activity android:name=".MainActivity"
android:theme="#style/customTheme"
android:screenOrientation="portrait"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
And this label is also reported on the titlebar! How to dissociate the two? (Like basically, still be able to give a name to the application without affecting my custom title-bar).
Thanks!
You can change the header of any activity by using setTitle("THE TITLE"); in the java code for the page. If you want to use a string defined in the XML FILES, you can use setTitle(R.string.stringName).
My opinion is to create your own custom title bar in the top of the screen and set the no title bar option in the manifest for the activity.
android:theme="#android:style/Theme.NoTitleBar"
try changing the label of your mainactivity to something like this android:label="#string/main_header" and define the string header in the strings.xml...
hope this good help you...

Categories

Resources