1, method One (if the input method is displayed on the window, then hide, or vice versa)[Java]View Plaincopyprint?
Inputmethodmanager IMM = (inputmethodmanager) getsystemservice (Context.input_method_service);
Imm.togglesoftinput (0, inputmethodmanager.hide_not_always);
2, Method Two (view is to accept the soft keyboard input views, show_forced means force display)[Java]
Recently there is a need to pop the soft keyboard when you click EditText, and then hide the soft keyboard when you click on an empty space or another control. This requirement is very useful on tablets, because the screen is large and users cannot hide at the bottom left corner every time, and it's easier to click in the blanks.Just beginning to search from the Internet, not very ideal, then suddenly think of the Android event distribution mechanism,
Today, we have summarized the common hidden code on Android phones and provided a reference to our friends who love Android phones.
Note that the following code should be used with caution, because some code may cause the mobile phone to lose its original functions. In addition, because the ROM author will modify some rom content, some code may not work on a mobi
You can set Setinputtype (inputtype.type_null) for EditText, and the input method will not pop up. When needed, set the Inputtyep dynamically.If a load activity can be used GetWindow (). Setsoftinputmode (WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);Hide the Input method, you do not have to judge the focus. O (∩_∩) oIf you want to get to the focus of the hidden input method, you can try (I did not try, but in the project code to see. On
Activity wants to windowing in Androidmanifest.xml set theme propertyAndroid:name= "Zicox.ui.activity.SearchPrinter"Android:theme= "@android: Style/theme.dialog" >In fact, the shadow activity is the hidden activity view.Find the method first to get activity Rootviewprivate static View Get_root_view (Activity context) { return (ViewGroup) Context.fin
This article attempts to imitate the implementation of the Android title display hidden function, by giving ListView set Mlistview.setontouchlistener listening rewrite Ontouch method to monitor the coordinates of the finger movement, When more than Viewconfiguration.get (this). Getscaledtouchslop (); The height of the toubar. When sliding up above this height shows Touba sliding down
Idea: Rewrite the Setontouchlistener event of the ListView;1Listview.setontouchlistener (NewOntouchlistener () {2 3 @Override4 Public BooleanOnTouch (View arg0, motionevent arg1) {5 //TODO auto-generated Method Stub6 Hidemenu ();//Hide Menu7 return false;8 }9 Ten});EnshinClick on the form blank place to hide the menu or the soft keyboard idea like:1 @Override 2 Public Boolea
Process Analysis of loading Android view to window, android View
In the previous blog, the Handler principle in Android talked about Handler and talked about how android Activity started to execute the onCreate method. This articl
Anyone who has used the Google Play store app or the app is aware that its actionbar can be hidden or displayed as the ListView slides. The effect looks very good, for this, I clumsily imitated a similar effect, do not know there is no better way.First on the main layout activity_main:Note that the toolbar here, we will use this toolbar to replace the original Actionbar.Now is the code in Mainactivity.java:public class Mainactivity extends baseactivit
area is determined when the view has just been drawn, and if the subsequent correspondence is disrupted, the system may also generate a default layout to clarify the area.A better solution comes out: The bottom action Bar is also used as a drop-down refresh area, that is, with the drop-down refresh component as a layout.The problem is solved, but I don't feel very comfortable: my drop-down refresh component is generic, as long as the drop-down refres
designs), we have to understand the principle.
The effect chart is as follows:
Without complicated configuration, a few lines of simple commands are as follows:
1. Generate IDE Tool files
Mmm development/tools/idegen/
The Idegen.jar file will be generated when the run is finished.
2, generate the Android studio configuration file
Mainly to generate ANDROID.IWS, ANDROID.IPR, ANDROID.IML,
You need to modify the ListView class override Onintercepttouchevent () and ontouchevent ()//experiment with another method, overwriting the ontouchevent () of the drag icon in each row of the ListView, but the effect is not ideal. public class Mainactivity extends Activity {deleteadapter Deleteadapter;draglistview listview;boolean bflag;i Magebutton button; @Overridepublic void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (r.layout.activity_main);d e
Android provides properties in the layout and can simply add animation effects, as follows:When you add a delete, hide, or display to a view in a layout, there will be a fade, and displacement animation.In addition to using attributes in an XML layout file animateLayoutChanges . You can also create LayoutTransition objects with the Setlayouttransition () method set in. The source code is as follows:private
Set the properties of layout to apply to Android view SetvisibilityThere are three values visibility VISIBLE, INVISIBLE, GONE.Visible invisible invisible, without occupying layout spaceJava code
Set display
Tv_main_title.setvisibility (view.visible);
Settings do not display or occupy space
Tv_main_title.setvisibility (View.gone);
Setting does not display but takes up space
Tv_ma
In Android development, when using the ListView, we often use Footerview or HeaderviewThe footer and headers added to the ListView are often hidden and displayed depending on the situation.Because footer and headers use the methods of deletion and addition, they always feel bad.When you set the view in footer and header directly to gone, the area is still occupie
[Unity3D] Unity3D game development: embedding Unity view in Android view, unity3dandroid
Certificate ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you like my blog, please remember my name: Qin Yuanpei. My blog address is blog.csd
Make the Project view of Android Studio similar to the Anroid view, androidanroid
For differences between the AS Project and the Android view, see my blog.
Http://blog.csdn.net/siyehuazhilian/article/details/42123563
The Android
;
Import android. widget. EditText;
Import android. widget. Toast;
Public class FileButtonOnClickEvent implements OnClickListener {
// Obtain other controls through activity
Private Activity;
// Read and write files through FileService
Private FileService fileService;
// Tag used to print information
Private static final String TAG = "FileButtonOnClickEvent ";
P
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.