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 ;}}}