xml - 如何使用 XML 在 android 中创建 google 登录/向上按钮?
问题描述
我不想在我的 Android 应用程序中使用任何图像
有没有办法只用XML制作它?
解决方案
尝试使用此代码在 xml 布局中创建相同的视图
主要的.xml
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dimen_15"
app:cardCornerRadius="@dimen/dimen_15">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dimen_5">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SIGN IN/UP WITH GOOGLE"
android:drawableLeft="@drawable/ic_google"
android:drawablePadding="@dimen/dimen_13"
android:gravity="center"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
推荐阅读
- jquery - 如何解决此无“访问控制允许来源”错误
- c# - 无法在 ASP.NET MVC 5 中从控制器设置 Toastr 消息
- javascript - 如果 div 不包含具有给定类的元素,则执行一些代码
- java - 带有嵌入式tomcat v8的spring boot未在linux环境中解码查询参数
- php - 443端口无缘无故附加到主机名
- flutter - Flutter 使用 FutureBuilder 我们如何创建具有延迟加载或更多加载元素调用 Web 服务的列表
- python - 字符串值未更新
- redis - 在 redis 服务器端评估的 lua 脚本中,应该使用键而不是扫描吗?
- excel - 我的代码没有删除行,其余一切正常
- reactjs - 生产中的 Create-React-App:找不到路由