Android horizontal navigation menu

Source: Internet
Author: User

Android horizontal navigation menu
1.:


  <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4NCjxoMyBpZD0 = "2 Project address"> 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
  
   
GetMenuItems () {// TODO Auto-generated method stub return Arrays. asList (names) ;}@ Override public List
   
    
GetContentViews () {// TODO Auto-generated method stub List
    
     
Views = new ArrayList
     
      
(); 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 ;}}}
     
    
   
  

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.