1.
<relativelayout Android:id="@id/classify_background"Android:layout_width="match_parent"Android:layout_height="wrap_content"Android:background="@mipmap/classify_background"Android:layout_margintop="15DP"Android:layout_marginleft="10DP"Android:layout_marginright="10DP"> <Button Android:id="@id/classifyarrowrigh"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:layout_alignparentright="true"android:layout_centervertical="true"Android:layout_marginbottom="9DP"Android:layout_marginright="10DP"Android:background="@drawable/classify_arrow_righr_selected"/> <Button Android:id="@id/classifyarrowleft"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:layout_alignparentleft="true"Android:layout_marginleft="10DP"android:layout_centervertical="true"Android:layout_marginbottom="9DP"Android:background="@drawable/classify_arrow_left_selected"/> <!--scroll bars can be scrolled android:layout_toleftof="@id/classifyarrowrigh"The direction of scrolling, this sentence is very important, do not write all show Android:scrollbars="None": Hide scroll Bar-<Horizontalscrollview Android:id="@id/horizontalscview"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:scrollbars="None"Android:layout_marginleft="15DP"Android:layout_torightof="@id/classifyarrowleft"Android:layout_toleftof="@id/classifyarrowrigh"> <LinearLayout Android:id="@id/classify_layout"Android:layout_width="match_parent"Android:layout_height="wrap_content"android:gravity="Center"android:orientation="Horizontal"> </LinearLayout> <!--to fill in this layout can also be used gradview--> To set the left and right slide key codes for two buttons are:
android: Layout_torightof= "@id/classifyarrowleft" android:layout_toleftof=" @id/classifyarrowrigh "
2. When you set a click event in a Java file, The left and right two buttons must have their own sliding distance, and the sliding direction is not the same (plus or minus), not two buttons share a sliding distance, so that two buttons are all a sliding function.
flingvelocitypx=; the sliding distance of the right button,
flingvelocitypx1=-; sliding distance of left button Android:layout_torightof
, and also set two individual click events to invoke the sliding distance of the respective Gradview
To implement the left and right switching of the Android news client title bar