set layout background to call screen - android

I have an intent that makes a call and then the call event start; I want to set background layout for that Make_Calling screen
Can anyone help me?
"Set layout for this(Image) call make screen!!"
Thanks in Advance
Like the above(2nd) image...

Pretty much easy... In layout file there will be a LinearLayout or RelativeLayout or FrameLayout. use android:background attribute and pass drawable in it.

The layout xml has a attribute background. You can set in xml or do the same in code as well. android:background="#drawable/image.png"
You want to customize the default calling or incoming screen if I am right. It is not possible to customize the default screens. However, you will be able to replace the default screen with your own view. You can create an activity which calls your customised view and add the intent to the Activity in the Manifest file, similar to below
<activity class=".MyCustomCallActivity" android:label="#string/mycustomcall_title">
<intent-filter>
<action android:name="android.intent.action.ANSWER" />
</intent-filter>
</activity>
Read Intent for more details on how to handle intents

Related

how to move the entair screen up when keyboard enabled?

I want to scroll up the entair screen up when keyboard opened like below.How to do that?
https://www.screencast.com/t/34JwVngLdYbU
Apply android:windowSoftInputMode="adjustPan|adjustResize" with activity tag in manifest file.
android:windowSoftInputMode="adjustPan|adjustResize"
and put complete layout in LinearLayout and ScrollView & define
layout_height="0dp"
layout_weight="1"
Note: No view have parameter layout_height="match_parent"
I had also same issue just adding a single line to my AndroidManifest file's activity.
<activity
android:name=".activities.YOURACTIVITY"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize|stateVisible"/>
If you want keyboard should appear with start Activity then use stateVisible otherwise use stateHidden.
Here the most important value is the adjustResize. This will shift the whole UI up to give room for the softkeyboard.

How do I avoid this meshing of textview and buttons?

Issue:
I have seen this overlap anytime I have a button under a textview or edittext. If I try to add text to one of these, the keyboard forces the buttons to raise. What causes this overlap and how can I avoid it?
Try android:windowSoftInputMode="adjustNothing" in your AndroidManifest.xml file for the activity you're using the layout, for example:
<activity
android:name=".MainActivity"
android:windowSoftInputMode="adjustNothing">
For more info go to the following link: http://developer.android.com/reference/android/R.attr.html#windowSoftInputMode
Change RelativeLayout to other type of layout or specify different android:windowSoftInputMode in your manifest for this activity.

How to move the layout up when the soft keyboard is shown android

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"

How to add TitleBar in this android example?

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.

Different activity title in different intent actions

I have one activity and three intet filters, each with different label set on, (AndroidManifiest.xml below)
<activity android:name=".activities.RecordActivity">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="com.keitai.enigma.OPEN_RECORD" />
</intent-filter>
<intent-filter android:label="#string/newRecord">
<category android:name="android.intent.category.DEFAULT" />
<action android:name="com.keitai.enigma.NEW_RECORD" />
</intent-filter>
<intent-filter android:label="#string/editRecord">
<category android:name="android.intent.category.DEFAULT" />
<action android:name="com.keitai.enigma.EDIT_RECORD" />
</intent-filter>
</activity>
But activity title is not changing to label set in intent filter :( Activity always contains application label.
What I'm donig wrong?
Are you sure you don't have code that is setting the title explicitly?
Are you sure that the OPEN_RECORD intent isn't the one being triggered every time?
Have you tried debugging by making sure everything has a distinct label (application, activity, each intent-filter) and seeing what happens?
I agree with you that what you expected to happen is what the docs say should happen. But it seems like the default <application> label is being used regardless. I'm afraid if one of the above ideas doesn't help, then I'm out of ideas. I might try it myself later on my system to see if it happens for me.
http://developer.android.com/guide/topics/manifest/intent-filter-element.html#label
android:label
A user-readable label for the parent component. This label, rather than the one set by the parent component, is used when the component is presented to the user as having the capability described by the filter.
...
The default value is the label set by the parent component. If the parent does not specify a label, the default is the label set by the element's label attribute.
http://developer.android.com/guide/topics/manifest/manifest-intro.html#iconlabel
Icons and Labels
...
In every case, the icon and label set in a containing element become the default icon and label settings for all of the container's subelements. Thus, the icon and label set in the element are the default icon and label for each of the application's components. Similarly, the icon and label set for a component — for example, an element — are the default settings for each of the component's elements. If an element sets a label, but an activity and its intent filter do not, the application label is treated as the label for both the activity and the intent filter.
...
You use intents usually to pass information between activities, apps or services (just few examples).
My understanding is, that you want to change your title of one activity depending on e.g. if a button is pressed.
Therefore you need to set simply in your activity
this.setTitle("YOUR ACTIVITY NAME");
In case you want this to happen after a button click, put it into the listener of the corresponding button.
Actually, from your example I'd suggest that you use separate activities (which can specify labels that are shown as titles!).
In Android, one activity usually corresponds to one use case - so if OPEN_RECORD shows a dialog where the user can select a record and EDIT_RECORD allows to edit a record, than you would usually have two different activities.
Have a look at the notepad tutorial for an example.

Categories

Resources