To implement the left and right switching of the Android news client title bar

Source: Internet
Author: User

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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.