Sometimes we nest a ListView in the ScrollView, and when we switch the activity, when we nest the ListView (there are some controls on the ListView), we find the entireScrollView want to swipe down until the ListView is pinned, and the above controls can't be displayed, we can do this:Put the view on the top of the diagram, and then do this in the code:View.setfocusable (True); View.setfocusableintouchmode (true); View.requestfocus ();through the setf
is switched on, activity A is destroyed and activity A is automatically created after the screen switch, so onsaveinstancestate is bound to be executed. In summary, Onsaveinstancestate's invocation follows an important principle that when the system destroys your activity "without your permission", then Onsaveinstancestate is called by the system, which is the responsibility of the system, Because it has to provide an opportunity for you to save your
The android:screenorientation= "Landscape" attribute can be added to the configuration of Androidmanifest.xml activity (which requires an activity that prohibits steering) (landscape is horizontal, Portrait is a vertical screen). For example:
The code is as follows
Copy Code
Package= "Com.ray.linkit"Android:versioncode= "1"Android:versionname= "1.0" >Android:label= "@string/app_name"android:screenorientation= "Portrait" >android:screenorientation= "Portrait" >android
distributionViewGroup passed through the dispatchtouchevent--->onintercepttoucheventIterates through the child view from the back, if the child view can handle the event returns TRUE. Pass to this endIf the child view cannot handle the event, handle it yourself .... ontoucheventView Handling EventsDispatchtouchevent-> ontouch–-> ontoucheventSetting the Listener Ontouch returns TRUE or returns false but Ontouchevent returns true to assume that the child view processed the event successfullyIf Fa
the instance of the intent object in the context switch that makes itself bootable5. With the intent object instance obtained, use the Getstringextra to get the value of the previous Putextra.Of course, if you know more about intent in the future, you need to pick a more appropriate function for storing data and getting the data according to the actual situation.The following is a demonstration of the implementation:Finally, attach the key part code:
Android Imitation QQ home message and phone switch, first page of the head (completely with layout control)First, put seven control layout codes1.title_text_sel.xml the font color to be placed under the color folder2.rb_bg_01.xml left RadioButton Background selection3.rb_bg_01f.xml left RadioButton Background selection4.rb_bg_01t.xml left RadioButton Background selection5.rb_bg_02.xml right side RadioButton
Software platform: Windows 7 + Eclipse + SDK
Design ideas:
Two pages: Mian and OK, there is a button on each page, click can switch to each other
Source:
Main.xml Source code:
The code is as follows
Copy Code
XML version= "1.0" encoding= "Utf-8"?>android:orientation= "Vertical"Android:layout_width= "Fill_parent"android:layout_height= "Fill_parent">Android:layout_width= "Fill_parent"android:layout_height= "Wrap_content
Previously with Tabhost just click on the Navigation bar tab to switch, today tried the next gesture swipe to switch, searched a lot of information feel particularly chaotic, spent a good long time finishing a bit finally has the effect, wrote a demo.Program Listing 1: Layout fileDescription: Same as we write Tabhost layout fileActivity_main.xmlandroid:orientation= "Vertical"Android:layout_width= "Fill_pare
If you write an android desktop sliding switch Screen Control (1)
First, this control should inherit ViewGroup:
Initialization:
Public class MyGroup extends ViewGroup {private Scroller mScroller; private float mOriMotionX; private float handler; private VelocityTracker handler; private int mTouchState = running; private static final int TOUCH_STATE_REST = 0; private int mTouchSlop; private int mMaximumVelo
Android studio Daily Post 9. How can I use the navigation bar to quickly switch between views in a project ?, Androidstudio ViewAndroid studio Daily Post 9. How to use the navigation bar to quickly switch between views in a project? Operation Method:
In the navigation bar, you can quickly switch to view display in the
transparency to 0.5 when the pop-up window is open, and set the transparency to 1 when the popup disappears
Popupwindow Monitor Click event: Listen to our popupwindow inside the control's Click event
Get the height of the Navigationbar: Here you need to fit some phones without navigationbar some phones have, here with the presence of Navigationbar to demonstrate
On the mobile phone where Navigationbar is present, set the location where its popupwindo
EditText dynamic set of clear text, ciphertext switch:There are two methods for dynamically setting clear text and ciphertext switching in the code in EditText:1. EditText EDT = new EditText (context);Ciphertext: Edt.settransformationmethod (Passwordtransformationmethod.getinstance ());PlainText: Edt.settransformationmethod (Hidereturnstransformationmethod.getinstance ());2.PlainText: Edt.setinputtype (Inputtype.type_class_text | Inputtype.type_text_variation_password);Ciphertext: Edt.setinputty
Recently introduced the latest 4.4 desktop to eclipse spent a few nights, fix some error. Finally can run.The code for single found on 4.4luancher has changed.Find the next, more convenient in the launcherappstate inside, configuration can be.Can be single or double-layer switching.public static Boolean Isdisableallapps () {Returns false on Non-dogfood builds.Return getinstance (). Mbuildinfo.isdogfoodbuild () Launcher.ispropertyenabled (Launcher.disable_all_apps_property);}(one)
Lock the horizontal or vertical screen.When the screen orientation is not specified, the next change is based on the orientation of the screen, that is: android:screenorientation= "unspecified"You can configure the screen to make changes in the Androidmanifest.xml file, or you can configure it in Java codeConfigure in Androidmanifest.xml:If you make an activity do a change in the screen, add the following configuration to the activity's label.-activity android:label= "@string/app _na
When the two activity jumps, as the second activity loads more data at startup, a short black screen time will appear before the start, and a simple way to solve the problem is to set the second activity theme to transparent. This will turn the black screen on the second activity to show the first activity interface. This is done in two steps:The first step: Add the theme of the custom activity in Xxx/res/values/styles.xml as follows:[HTML] Step Two: Set the second activity's "Android:theme" pr
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.