コード例 #1
0
 private void initScrollView(View root) {
   mItemHScrollView = (ItemHScrollView) root.findViewById(R.id.typeTab);
   RelativeLayout.LayoutParams params =
       (RelativeLayout.LayoutParams) mItemHScrollView.getLayoutParams();
   params.height = (int) (ScreenAdapter.getInstance(null).getHeadHeight() * 0.7f);
   mItemHScrollView.requestLayout();
   mItemHScrollView.setPositionOffset(0);
   mItemHScrollView.setOnItemClickListener(
       new ItemHScrollView.OnItemClickListener() {
         @Override
         public void onItemClick(ViewGroup parent, View view, int position) {
           mViewPager.setCurrentItem(position);
         }
       });
 }
コード例 #2
0
  private void initView(View root) {
    initScrollView(root);
    initViewPager(root);
    lanmu = (ListView) root.findViewById(R.id.lanmu);
    lanmu.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            mViewPager.setCurrentItem(position);
            view.postDelayed(
                new Runnable() {
                  @Override
                  public void run() {
                    if (list_content.getVisibility() == View.VISIBLE) {
                      arrowlistener();
                    }
                  }
                },
                250);
          }
        });
    list_title = root.findViewById(R.id.list_title);
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) list_title.getLayoutParams();
    params.height = (int) (ScreenAdapter.getInstance(null).getHeadHeight() * 0.7f);
    list_title.requestLayout();

    list_content = root.findViewById(R.id.list_content);
    arrowiconParent = root.findViewById(R.id.arrowiconParent);
    arrowicon = (ImageView) root.findViewById(R.id.arrowicon);
    arrowiconParent.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            arrowlistener();
          }
        });
  }