android - 在 android 4.1 中使用 android L 按钮,例如 google plus app

标签 android android-5.0-lollipop

我正在寻找一种在 android 4.1 及更高版本中使用来自 android L 的圆形按钮的方法,就像"new"google plus 应用程序一样。
example for button
是否有任何反向移植库或其他东西(可能具有更多 android l 设计功能)?
我已经看过 google.com/design -> ressources 和 developer.android.com

最佳答案

这只是您想要的示例(我认为)

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.sockettest.MainActivity"
    tools:ignore="MergeRootFrame" >

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="250dp"
        android:layout_height="100dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:background="#ccc"
        android:orientation="vertical" >
    </LinearLayout>

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/linearLayout1"
        android:src="@drawable/ic_launcher"
        android:layout_marginLeft="-20dp" />

</RelativeLayout>

您将 imageView 的左侧调整到布局的右侧,然后设置负边距 (-20)。

但要小心,imageView 必须低于您的布局,(您可以将 Layout 与 imageView 交换以查看结果)

关于android - 在 android 4.1 中使用 android L 按钮,例如 google plus app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24465480/

相关文章:

Android Alpha,Google Play 开发者控制台上付费应用的 Beta

java - 在 firebase 数据库中按日期排序

java - 控制硬件功能

android - 如何在 android L 中打开省电模式

android - WebView 媒体内容在屏幕锁定时停止(调用 Activity 的 onStop)

java - 检查通话中断 - Android Lollipop

android - Firebase 无法获取最后一个插入值

Android - 在 AsyncTask 中显示警报对话框

android - 最新支持库v4需要minSdk(API 20, L Preview)?

android - 使用自定义图标字体时如何修复 Android Lollipop 中的字体基线?