Android layout 什么';这是什么布局,有关于这个的例子吗?

Android layout 什么';这是什么布局,有关于这个的例子吗?,android-layout,Android Layout,什么是加载(模糊)然后显示图标布局? 如何创建这样一个?您可以开始检查微光效果。这有助于您在执行一些额外工作(或加载某些内容)时将任何项目布局结构显示为占位符 结果: 如何做: 首先,将facebook Shimmer库添加到build.gradle中: dependencies { implementation 'com.facebook.shimmer:shimmer:0.1.0@aar' } <?xml version="1.0" encoding="utf-8"?>


什么是加载(模糊)然后显示图标布局?

如何创建这样一个?

您可以开始检查微光效果。这有助于您在执行一些额外工作(或加载某些内容)时将任何项目布局结构显示为占位符

结果:

如何做:

首先,将facebook Shimmer库添加到build.gradle中:

dependencies {
   implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="20dp"
    android:layout_marginLeft="10dp">

    <View
        android:id="@+id/thumbnail"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:layout_marginRight="16dp"
        android:layout_marginTop="10dp"
        android:background="#dddddd"/>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/thumbnail"
        android:layout_marginTop="10dp"
        android:orientation="vertical">

        <View
            android:layout_width="100dp"
            android:layout_height="8dp"
            android:background="#dddddd" />
        <View
            android:layout_width="30dp"
            android:layout_height="8dp"
            android:layout_marginTop="5dp"
            android:background="#dddddd" />

    </LinearLayout>

</RelativeLayout>
然后创建占位符\u layout.xml:

dependencies {
   implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="20dp"
    android:layout_marginLeft="10dp">

    <View
        android:id="@+id/thumbnail"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:layout_marginRight="16dp"
        android:layout_marginTop="10dp"
        android:background="#dddddd"/>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/thumbnail"
        android:layout_marginTop="10dp"
        android:orientation="vertical">

        <View
            android:layout_width="100dp"
            android:layout_height="8dp"
            android:background="#dddddd" />
        <View
            android:layout_width="30dp"
            android:layout_height="8dp"
            android:layout_marginTop="5dp"
            android:background="#dddddd" />

    </LinearLayout>

</RelativeLayout>
注意:当视图不再可见时,不要忘记启动和停止组件。使用onResume()onPause()

希望这对你有帮助


来源:

搜索有关微光动画的信息