-
自定義指示器:(Shift+AltM可抽取方法) mtabline = (ImageView) findViewById(R.id.id_iv_tabline); //獲取屏幕的像素 Display defaultDisplay = getWindow().getWindowManager().getDefaultDisplay(); DisplayMetrics outMetrics = new DisplayMetrics(); defaultDisplay.getMetrics(outMetrics); //獲取1/3的屏幕寬度 mScreen1_3 = outMetrics.widthPixels / 3; //給mtabline設置寬度 LayoutParams lp = mtabline.getLayoutParams(); lp.width = mScreen1_3; mtabline.setLayoutParams(lp);查看全部
-
主要在于ViewPager的使用: 一、利用FragmentPagerAdapter添加tab頁面 二、其次是使用addPagerChangerListener方法添加頁面切換的監聽,在這里可以改變tab標題顏色,設置指示器的跟隨。比如在onPageSelected方法中設置顏色的變化,其次是在onPageScrolled方法中利用ImageView的setTranslationX方法結合position參數和positionOffset設置ImageView的偏移即可 最后BadgeView(其繼承自TextView)中的setTarget放將目標View從其父布局中抽出來,然后使用frameLayout包裝二者的方法. private void forceShowOverflowMenu(boolean flag) { try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class .getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, flag); } } catch (Exception e) { e.printStackTrace(); } }查看全部
-
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:orientation="horizontal" > <ImageView android:layout_width="30dp" android:layout_height="30dp" android:src="@drawable/actionbar_search_icon" /> <ImageView android:layout_width="30dp" android:layout_height="30dp" android:src="@drawable/actionbar_add_icon" /> <ImageView android:layout_width="30dp" android:layout_height="30dp" android:src="@drawable/actionbar_more_icon" /> </LinearLayout>查看全部
-
差點的薩達查看全部
-
主要在于ViewPager的使用: 一、利用FragmentPagerAdapter添加tab頁面 二、其次是使用addPagerChangerListener方法添加頁面切換的監聽,在這里可以改變tab標題顏色,設置指示器的跟隨。比如在onPageSelected方法中設置顏色的變化,其次是在onPageScrolled方法中利用ImageView的setTranslationX方法結合position參數和positionOffset設置ImageView的偏移即可 最后BadgeView(其繼承自TextView)中的setTarget放將目標View從其父布局中抽出來,然后使用frameLayout包裝二者的方法. private void forceShowOverflowMenu(boolean flag) { try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class .getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, flag); } } catch (Exception e) { e.printStackTrace(); } }查看全部
-
Tab 主界面查看全部
-
去掉actionbar查看全部
-
ctrl shift t,查找類查看全部
-
主界面引入其它布局文件查看全部
-
小紅點的消息提醒制作查看全部
-
tab類型app的主界面總結查看全部
-
在代碼中修改xml文件中已經定義的控件的屬性查看全部
-
動態設置控件的寬查看全部
-
類的查找:ctrl + shift + t查看全部
-
https://github.com/stefanjauker/BageView查看全部
舉報
0/150
提交
取消