Android horizontal navigation menu, android navigation menu

Source: Internet
Author: User

Android horizontal navigation menu, android navigation menu
1.:



2. Project address:

Https://github.com/lynnchurch/HorizontalScrollMenu.git

3. Use sample code:
Package com. example. horizontalscrollmenusample; import java. util. arrayList; import java. util. arrays; import java. util. list; import com. lynnchurch. horizontalscrollmenu. baseAdapter; import com. lynnchurch. horizontalscrollmenu. horizontalScrollMenu; import android. app. activity; import android. OS. bundle; import android. view. layoutInflater; import android. view. view; import android. widget. textView; public class MainActivity extends Activity {private HorizontalScrollMenu hsm_container; @ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. activity_main); initView ();} public void initView () {hsm_container = (HorizontalScrollMenu) findViewById (R. id. hsm_container); hsm_container.setAdapter (new MenuAdapter ();} class MenuAdapter implements BaseAdapter {String [] names = new String [] {"menu 1", "menu 2 ", "menu 3", "menu 4", "menu 5", "menu 6", "menu 7" };@ Override public List <String> getMenuItems () {// TODO Auto-generated method stub return Arrays. asList (names) ;}@ Override public List <View> getContentViews () {// TODO Auto-generated method stub List <View> views = new ArrayList <View> (); for (String str: names) {View v = LayoutInflater. from (MainActivity. this ). inflate (R. layout. content_view, null); TextView TV = (TextView) v. findViewById (R. id. TV _content); TV. setText (str); views. add (v) ;}return views ;}}}

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.