A method for switching an input method virtual keyboard, comprising: displaying, by a terminal, a first session interface of an application on a touchscreen, wherein the first session interface refers to a chat interface during a session with a group; determining, by the terminal, a first session message in the first session interface, wherein the first session message is a recently received session message; determining, by the terminal, a corresponding first virtual keyboard based on a type of the first session message, wherein the type of the first session message comprises a text message, a numeric message, an emoticon message, or a voice message; displaying, by the terminal in response to a touch operation on an input box in the first session interface, the first virtual keyboard in the session interface; receiving, by the terminal, a specific character and a first contact that are input by a user into the input box, wherein the first contact is a contact in the group; determining, by the terminal, a session message recently sent by the first contact in the group as a second session message; determining, by the terminal, a corresponding second virtual keyboard based on a type of the second session message; displaying, by the terminal, the second virtual keyboard in the first session interface, and hiding the first virtual keyboard; receiving, by the terminal, a specific character and a second contact that are input by the user into the input box, wherein the second contact is a contact in the group, and the second contact is different from the first contact; determining, by the terminal, a session message recently sent by the second contact in the group as a third session message; determining, by the terminal, a corresponding third virtual keyboard based on a type of the third session message; and displaying, by the terminal, the third virtual keyboard in the first session interface, and hiding the second virtual keyboard, wherein the third virtual keyboard, the second virtual keyboard, and the first virtual keyboard are different from each other. displaying, by a terminal, a first session interface of an application on a touchscreen, wherein the first session interface refers to a chat interface during a session with a group; determining, by the terminal, a first session message in the first session interface, wherein the first session message is a recently received session message; determining, by the terminal, a corresponding first virtual keyboard based on a type of the first session message, wherein the type of the first session message comprises a text message, a numeric message, an emoticon message, or a voice message; displaying, by the terminal in response to a touch operation on an input box in the first session interface, the first virtual keyboard in the session interface; receiving, by the terminal, a specific character and a first contact that are input by a user into the input box, wherein the first contact is a contact in the group; determining, by the terminal, a session message recently sent by the first contact in the group as a second session message; determining, by the terminal, a corresponding second virtual keyboard based on a type of the second session message; displaying, by the terminal, the second virtual keyboard in the first session interface, and hiding the first virtual keyboard; receiving, by the terminal, a specific character and a second contact that are input by the user into the input box, wherein the second contact is a contact in the group, and the second contact is different from the first contact; determining, by the terminal, a session message recently sent by the second contact in the group as a third session message; determining, by the terminal, a corresponding third virtual keyboard based on a type of the third session message; and displaying, by the terminal, the third virtual keyboard in the first session interface, and hiding the second virtual keyboard, wherein the third virtual keyboard, the second virtual keyboard, and the first virtual keyboard are different from each other.