android - How to use button in activity to jump to information in same activity? -
I would like to know whether it is possible to make a button in the activity to jump to scroll weave according to the information given below. Sort like:
Button 1 button 2 button 3 paragraph 1 paragraph 2 paragraph 3
So when the button selects 1, you start the paragraph In 1 further, this does not have to scroll down to user relevant paragraphs / information or to start a new activity. (To move related information on the same page as many pages with titles at the top on the page.)
OK, I have tried sofar:
Last View Routeview = Inflator.In Flat (R. Late Fragment_SNnex, Container, False); Button Button = (Button) rootView.findViewById (R.id.Button1); button.setOnClickListener (New OnClickListener () {public void onClick (final scene v) {mScrollView = (scrollview) rootView.findViewById (R.string.TextView1); mScrollView.smoothScrollTo (R.id.TextView1, 0);}}) ;
Then I get this error:
11-05 09: 28: 43.722: E / Android time (30741): java.lang.NullPointerException 11 - 05 09: 28: 43.722: e / AndroidRuntime (30741): 28 :: 43.722: e / AndroidRuntime (30741): Android com.test.testpark.StestFragment $ 1.onClick (StestFragment.java:34) 11-05 In September, view.View.performClick (see.Java 4637) 11-05 09: 28: 43.722: E / Android Random (30741): On Android. View.View $ PerformClick.run (see. Java 19422) 11-05 09: 28: 43.722: E / Android Random (30741): Android. OS Handler's eighth callback (handler. 733) 11-05 09: 28: 43.722: E / Androindertime (30741): On Android.OS Handler. Send message (handler. Java: 9-5) 11-05 09: 28: 43.722: E / Android Random (30741): Android.OS Lopper Oops (Looper.java:136) 11-05 09: 28: 43.722: E / AndroidRuntime (30741): android.app.ActivityThread.main (ActivityThread.java:5586) 11-05 September: 28: 43.722: E / AndroidRuntime (30741): java.lang.reflect.Method.invokeNative (Native method) 11-05 09: 28: 43.722: e / Androidar untime (30741): java.lang.reflect.Method.invoke (Method.java 515) on September 11 to 5: 28: 43.722: e / AndroidRuntime (30741): 268 $ MethodAndArgsCaller .run (Jhigoteinitkjawaiar on com.android.internal.os.ZygoteInit) 11-05 09: 28: 43.722: e / Androidrentaim (30741) on com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1084) 11-05 09:28: 43.722: e / Android Rentman (30741) on Dalvik.system.NativeStart.main (Basic method)
Is there a tuition Real do I follow?
Any suggestions?
Edit
11-05 10:41: 36.770: E / Android Random (3630): java.lang.NullPointerException 11- 05 10:41: 36.770: E / AndroidRuntime (3630): 41 :: 36.770: E / AndroidRuntime (3630): com.test.testpark.StestFragment $ 1.onClick (stestFragment.java35) on android.view.View October 11-5. DisplayClickKey (see.Java 4637) 11-05 10: 41: 36.770: E / Android Rendime (3630): On Android. View.View $ PerformClick.run (Dekenkjawa 1 9 422) 11-05 10: 41: 36.770: E / Android Rentaim (3630): Androidkoskhandlr Acandle Allback (handler C. Jawaः 733) 11-05 10: 41: 36.770: E / Android Random (3630): Android. OS Handler Dispatch Message (Handler. Java: 9-5) 11-05 10: 41: 36.770: E / AndroidRuntime (3630): android.os.Looper.loop (Looper.java:136) at 11-05 October: 41: 36.770: E / AndroidRuntime (3630): for android.app.ActivityThread.main (ActivityThread.java:5586) for SmoothcrollTo (int, int)
, but easily scroll rather than immediately.
Parameter: Position x where to scroll the Y position on the X axis to scroll on the Y axis
Then you can use the TextView id (R.id.TextView1) ), But the text view status, something like this:
See the final view Rootview = Inflator. In flat (R.layout.fragment_snakes, container, false); Button Button = (Button) rootView.findViewById (R.id.Button1); TextView paragraph 1 = (TextView) RouteviewFindViewID (RaidTextView1); ScrollView scrollView = (ScrollView) rootView.findViewById (R.id.ScrollView); Button.setOnClickListener (New OnClickListener) {Click Public Zero (see last v) {scrollView.smoothScrollTo (0, paragraph 1.getTop ());}});
Comments
Post a Comment