草庐IT

toolbars

全部标签

android - 使用 viewpager 折叠 ToolBar 布局

我正在将CollapsingBarLayout与viewpager一起使用,并且viewpager的fragment具有listview、gridview。这是我的代码:具有listview,gridview的fragment在折叠工具栏中不向上滚动,我该如何实现这个工作..请帮助我,非常感谢您... 最佳答案 您需要将ViewPager放在AppBar部分并设置layout_behavior:>//THISVIEWSWILLBECOLLAPSED//THISVIEWSWILLBEPINNED如果您使用Fragments作为View

android - getSupportActionBar().setTitle() 与 toolbar.setTitle()

我知道有两种方法可以在AndroidActivity中设置标题。假设我已经有以下代码...@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.my_activity);...Toolbartoolbar=(Toolbar)findViewById(R.id.my_toolbar);setSupportActionBar(toolbar);...我可以使用这个...getSupportActionBar().s

android - getSupportActionBar().setTitle() 与 toolbar.setTitle()

我知道有两种方法可以在AndroidActivity中设置标题。假设我已经有以下代码...@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.my_activity);...Toolbartoolbar=(Toolbar)findViewById(R.id.my_toolbar);setSupportActionBar(toolbar);...我可以使用这个...getSupportActionBar().s

android - 如何在 PreferenceActivity 中添加 ToolBar?

我想在我的android应用程序的PreferenceActivity中添加ToolBar。我写了以下代码。publicclassSettingsActivityextendsPreferenceActivity{SendSMSsms;protectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);addPreferencesFromResource(R.xml.settings);LinearLayoutroot=(LinearLayout)findViewById(android.

android - 如何在 PreferenceActivity 中添加 ToolBar?

我想在我的android应用程序的PreferenceActivity中添加ToolBar。我写了以下代码。publicclassSettingsActivityextendsPreferenceActivity{SendSMSsms;protectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);addPreferencesFromResource(R.xml.settings);LinearLayoutroot=(LinearLayout)findViewById(android.

android - 在 Toolbar 和 LinearLayout 之间的左侧无法解释的间隙/填充

我在我的AndroidStudio项目的布局文件中有以下结构,我看到父元素(工具栏)和它的直接子元素(线性布局)之间无法解释的左填充。布局文字如何消除这个间隙并让子LinearLayout与父Toolbar完全对齐? 最佳答案 将这些行添加到您的工具栏布局:对于APIapp:contentInsetLeft="0dp"app:contentInsetStart="0dp"对于API21>=工具栏:android:contentInsetLeft="0dp"android:contentInsetStart="0dp"左侧插入是由To

android - 在 Toolbar 和 LinearLayout 之间的左侧无法解释的间隙/填充

我在我的AndroidStudio项目的布局文件中有以下结构,我看到父元素(工具栏)和它的直接子元素(线性布局)之间无法解释的左填充。布局文字如何消除这个间隙并让子LinearLayout与父Toolbar完全对齐? 最佳答案 将这些行添加到您的工具栏布局:对于APIapp:contentInsetLeft="0dp"app:contentInsetStart="0dp"对于API21>=工具栏:android:contentInsetLeft="0dp"android:contentInsetStart="0dp"左侧插入是由To

Android 支持 Toolbar + ActionBarDrawerToggle 不更改为箭头

我在工具栏和抽屉上苦苦挣扎。当我将新fragment添加到后台堆栈时,我试图将汉堡切换到箭头,但没有办法做到这一点。也许我错过了一些东西,但我找不到方法。有人遇到同样的问题吗?这是声明:mDrawerToggle=newActionBarDrawerToggle(getActivityCompat(),/*hostActivity*/mDrawerLayout,/*DrawerLayoutobject*/((BaseActivity)getActivityCompat()).getToolbar(),R.string.navigation_drawer_open,/*"opendraw

Android 支持 Toolbar + ActionBarDrawerToggle 不更改为箭头

我在工具栏和抽屉上苦苦挣扎。当我将新fragment添加到后台堆栈时,我试图将汉堡切换到箭头,但没有办法做到这一点。也许我错过了一些东西,但我找不到方法。有人遇到同样的问题吗?这是声明:mDrawerToggle=newActionBarDrawerToggle(getActivityCompat(),/*hostActivity*/mDrawerLayout,/*DrawerLayoutobject*/((BaseActivity)getActivityCompat()).getToolbar(),R.string.navigation_drawer_open,/*"opendraw

android - 半透明/透明状态栏 + CoordinatorLayout + Toolbar + Fragment

我有以下设置:我正在使用AppCompatMainActivity,它包含一个fragment并有一个工具栏,向下滚动时会隐藏Fragment与RecyclerView所有应该适合屏幕的View在xml布局中都有相应的android:fitsSystemWindows="true"问题是,在这种情况下,我无法让状态栏透明。我所做的是:创建Activity并调用setContent然后我尝试调整Activity以通过编程方式获得半透明工具栏,如下所示:@TargetApi(Build.VERSION_CODES.LOLLIPOP)publicvoidthemeNavAndStatusBa