2014-09-07 4 views
6

스웜 안드로이드 애플 리케이션의 액션 바에 사용되는 요소는 무엇입니까? 네이티브 안드로이드 액션 바도 아니고 액션 바우처 락도 아닌 것 같아.스웜 앱 안드로이드 - 액션 바

screenshot of swarms actionbar

+2

** ** uiautomatorviewer **를 사용하여 알아보십시오. – CommonsWare

+0

감사합니다. 그 도구가 그 일을했습니다. –

+0

@AlockLeo, 내 대답이 도움이된다면 동의하는 것을 잊지 마십시오. –

답변

5

uiautomatorviewer 을 사용한 후에는 베이스 성분 좌측부위한 HorizontalScrollView 내부 ImageButtons, 우측 부분에 대한하여 ImageButton와의 LinearLayout이었던 것을 알 수있다. 그러나 여기에서는 슬라이딩 애니메이션을 얻는 방법이나 두 기능 부분을 잘 배치하는 방법에 대해 자세히 설명하지 않습니다.

this fantastic library을 사용하여 약간의보기 마사지를 사용하여 다시 만들었습니다. 기본적으로 호출기 슬라이딩 탭 스트립 (PSTS)을 사용자 정의보기로 작업 표시 줄에 제공합니다. action_bar_main.xml 당신은 또한 FragmentPagerAdapter는 PST의를 설정하는 방법을 변경해야 할이

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 


    <com.astuetz.PagerSlidingTabStrip 
     android:id="@+id/tabs" 
     android:layout_width="wrap_content" 
     android:layout_height="?android:attr/actionBarSize" 
     android:layout_alignParentBottom="true" 
     /> 


</RelativeLayout> 

인으로

//I call this in the onCreate()of my activity 
void setupActionBar() { 

    ActionBar actionBar = getActionBar(); 

    View vwActionBar = View.inflate(this, R.layout.action_bar_main, null); 
    tabs = (PagerSlidingTabStrip) vwActionBar.findViewById(R.id.tabs); 
    actionBar.setCustomView(vwActionBar); 
    actionBar.setDisplayShowCustomEnabled(true); 
    actionBar.setDisplayShowTitleEnabled(false); 
    actionBar.setDisplayShowHomeEnabled(false); 
} 

. 라이브러리 샘플은이 작업을 수행하는 방법에 대한 좋은 예를 보여 주지만, 여기에 대해서는 제가 있습니다.

public class MyPagerAdapter extends FragmentPagerAdapter 
    implements PagerSlidingTabStrip.IconTabProvider { 

    private final int[] ICONS = { 
     R.drawable.ic_home, 
     R.drawable.ic_dashboard, 
     R.drawable.ic_insights, 
     R.drawable.ic_stream 
    }; 

    public MyPagerAdapter(FragmentManager fm) { 
     super(fm); 
    } 

    @Override 
    public int getCount() { 
     return ICONS.length; 
    } 

    @Override 
    public android.support.v4.app.Fragment getItem(int position) { 
     return fragments.get(position); 
    } 

    @Override public int getPageIconResId(int i) { 
     return ICONS[i]; 
    } 
}