现在Android设计支持库已经推出,有没有人知道如何用它实现扩展的Fab菜单,比如Inbox App上的fab?
应该是这样的:

我正在使用支持库v21中的新工具栏更新我的应用程序.我的问题是,如果我没有设置"高程"属性,工具栏不会投射任何阴影.这是正常行为还是我做错了什么?
我的代码是:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/my_awesome_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:minHeight="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<FrameLayout
android:id="@+id/FrameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent">
.
.
.
Run Code Online (Sandbox Code Playgroud)
在我的Activity - OnCreate方法中:
Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
setSupportActionBar(toolbar);
Run Code Online (Sandbox Code Playgroud) android material-design android-5.0-lollipop android-toolbar
我目前正在学习如何将我的应用程序转换为Material设计,现在我有点卡住了.我添加了工具栏,我的导航抽屉覆盖了所有内容.
我现在正在尝试创建一个类似于材料指南中的可扩展搜索:

这就是我现在所拥有的,我无法弄清楚如何使它如上所述:

这是我的菜单xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_search"
android:icon="@android:drawable/ic_menu_search"
android:title="Search"
app:showAsAction="always"
app:actionViewClass="android.support.v7.widget.SearchView" />
</menu>
Run Code Online (Sandbox Code Playgroud)
这有效,我得到一个扩展到SearchView的菜单项,我可以很好地过滤我的列表.虽然看起来不像第一张照片.
我尝试使用MenuItemCompat.setOnActionExpandListener(),R.id.action_search所以我可以将主页图标更改为后退箭头,但这似乎不起作用.侦听器中没有任何内容被触发.即使它起作用,它仍然不会非常接近第一张图像.
如何在新的appcompat工具栏中创建看起来像材质指南的SearchView?
android toolbar android-appcompat searchview material-design
有没有一种简单的方法可以将Material Design图标存储库的所有图标导入到Android项目中而不会手动执行此操作?
我正在添加一个BottomNavigationView项目,我希望为所选选项卡添加不同的文本(和图标色调)颜色(以实现灰色非选定选项卡效果).android:state_selected="true"在颜色选择器资源文件中使用不同的颜色似乎不起作用.我还尝试使用android:state_focused="true"或使用其他项目条目android:state_enabled="true",但不幸的是没有效果.还尝试将state_selected属性设置为false(显式)为默认(未选中)颜色,没有运气.
以下是我将视图添加到布局的方法:
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:itemBackground="@color/silver"
app:itemIconTint="@color/bnv_tab_item_foreground"
app:itemTextColor="@color/bnv_tab_item_foreground"
app:menu="@menu/bottom_nav_bar_menu" />
Run Code Online (Sandbox Code Playgroud)
这是我的颜色选择器(bnv_tab_item_foreground.xml):
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@android:color/darker_gray" />
<item android:state_selected="true" android:color="@android:color/holo_blue_dark" />
</selector>
Run Code Online (Sandbox Code Playgroud)
我的菜单资源(bottom_nav_bar_menu.xml):
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_home"
android:icon="@drawable/ic_local_taxi_black_24dp"
android:title="@string/home" />
<item
android:id="@+id/action_rides"
android:icon="@drawable/ic_local_airport_black_24dp"
android:title="@string/rides"/>
<item
android:id="@+id/action_cafes"
android:icon="@drawable/ic_local_cafe_black_24dp"
android:title="@string/cafes"/>
<item
android:id="@+id/action_hotels"
android:icon="@drawable/ic_local_hotel_black_24dp"
android:title="@string/hotels"/>
</menu>
Run Code Online (Sandbox Code Playgroud)
我将不胜感激任何帮助.
我正在玩新的android.support.design.widget.TabLayout,并发现一个问题,在类定义中,没有方法可以更改指示器颜色和默认高度.
做一些研究,发现默认指示颜色取自AppTheme.具体来自这里:
<item name="colorAccent">#FF4081</item>
Run Code Online (Sandbox Code Playgroud)
现在,在我的情况下,如果我更改colorAccent,它将影响使用此值作为背景颜色的所有其他视图,例如ProgressBar
现在还有什么方法可以将indicatorColor更改为除此之外的其他东西colorAccent吗?
谷歌已经用4个新的预设主题改进了其Material Design Icons:
除了常规的填充/基线主题外,还有轮廓,圆角,双色和夏普:
但是,不幸的是,它并没有说任何地方如何使用新的主题.
我一直通过谷歌网络字体使用它包括链接:
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
Run Code Online (Sandbox Code Playgroud)
然后使用文档中建议的所需图标:
<i class="material-icons">account_balance</i>
Run Code Online (Sandbox Code Playgroud)
但它总是显示'填充/基线'版本.
我尝试过以下操作来使用Outlined主题:
<i class="material-icons">account_balance_outlined</i>
<i class="material-icons material-icons-outlined">account_balance</i>
Run Code Online (Sandbox Code Playgroud)
并将Web Fonts链接更改为:
<link href="https://fonts.googleapis.com/icon?family=Material+Icons&style=outlined" rel="stylesheet">
Run Code Online (Sandbox Code Playgroud)
等但它不起作用.
在那样的黑暗中拍摄是没有意义的.
tl;博士:有没有人尝试过使用新主题?它甚至像基线版本(内联html标签)一样工作吗?或者,它是否只是以SVG或PNG格式下载?
提前致谢.
Listview中的我的Cardview没有在Android L(Nexus 5)中显示阴影.圆形边缘也未正确显示.以下是Listview的适配器视图的代码:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res/com.example.myapp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="@android:color/white"
android:foreground="?android:attr/selectableItemBackground"
app:cardCornerRadius="4dp"
app:cardElevation="4dp" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<TextView
android:id="@+id/tvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="@dimen/padding_small"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/ivPicture"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tvName"
android:layout_centerHorizontal="true"
android:scaleType="fitCenter" />
<TextView
android:id="@+id/tvDetail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ivPicture"
android:layout_centerHorizontal="true"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" />
</RelativeLayout>
</android.support.v7.widget.CardView>
Run Code Online (Sandbox Code Playgroud)
和ListView xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res/com.example.myapp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/app_bg" >
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:cacheColorHint="#00000000"
android:divider="@android:color/transparent"
android:drawSelectorOnTop="true"
android:smoothScrollbar="true" /> …Run Code Online (Sandbox Code Playgroud) android android-listview material-design android-cardview android-5.0-lollipop
我想在Android Studio中对textview和imageview设置涟漪效果.我该怎么做?
material-design ×10
android ×7
icons ×2
grid-system ×1
material-ui ×1
reactjs ×1
searchview ×1
speed-dial ×1
textview ×1
toolbar ×1