直播app原始碼,標題欄隨頁面滑動之title移動定位效果

zhibo系統開發發表於2021-11-22

直播app原始碼,標題欄隨頁面滑動之title移動定位效果實現的相關程式碼

佈局程式碼:


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="
    android:layout_width="match_parent"
    android:layout_height="match_parent">
 
    <!--內容檢視部分-->
    <com.titleanim.kevin.MyScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
 
            <ImageView
                android:layout_width="match_parent"
                android:layout_height="210dp"
                android:scaleType="fitXY"
                android:src="@drawable/k_astronauts" />
 
            <View
                android:id="@+id/v_left"
                android:layout_width="30dp"
                android:layout_height="15dp"
                android:background="@color/colorAccent" />
 
            <TextView
                android:id="@+id/tv_titleBottom"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="我是標題"
                android:textColor="@color/colorAccent"
                android:textSize="16sp" />
 
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:lineSpacingExtra="15dp"
                android:text="航天英雄楊利偉。。。"
                android:textColor="#666666"
                android:textSize="14sp" />
 
        </LinearLayout>
    </com.titleanim.kevin.MyScrollView>
 
    <!--標題部分-->
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="70dp">
 
        <View
            android:id="@+id/v_titleBg"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:alpha="0"
            android:background="@android:color/white" />
 
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="45dp"
            android:layout_alignParentBottom="true">
 
            <ImageView
                android:id="@+id/iv_back"
                android:layout_width="45dp"
                android:layout_height="match_parent"
                android:contentDescription="@null"
                android:scaleType="centerInside"
                android:src="@drawable/selector_back" />
 
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_centerHorizontal="true"
                android:gravity="center_horizontal"
                android:orientation="horizontal">
 
                <View
                    android:id="@+id/v_leftTop"
                    android:layout_width="30dp"
                    android:layout_height="15dp"
                    android:layout_marginTop="45dp"
                    android:background="@color/colorAccent" />
 
                <TextView
                    android:id="@+id/tv_titleTop"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="45dp"
                    android:paddingLeft="5dp"
                    android:text="我是標題"
                    android:textColor="@color/colorAccent"
                    android:textSize="16sp" />
            </LinearLayout>
        </RelativeLayout>
    </RelativeLayout>
</RelativeLayout>


以上就是直播app原始碼,標題欄隨頁面滑動之title移動定位效果實現的相關程式碼, 更多內容歡迎關注之後的文章


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69978258/viewspace-2843410/,如需轉載,請註明出處,否則將追究法律責任。

相關文章