線上直播系統原始碼,實現在圖片上塗鴉並記錄塗鴉軌跡

zhibo系統開發發表於2023-04-28

線上直播系統原始碼,實現在圖片上塗鴉並記錄塗鴉軌跡

1.activity_main.xml介面

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="
    xmlns:app="
    xmlns:tools="
    android:id="@+id/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:gravity="center"
        android:orientation="horizontal">
</LinearLayout>
    <LinearLayout
        android:id="@+id/hw"
        android:layout_width="300dp"
        android:layout_height="500dp"
        android:layout_gravity="center"
        android:gravity="center"
        android:orientation="horizontal"></LinearLayout>
    <TextView
        android:id="@+id/txt_result"
        android:layout_gravity="center"
        android:layout_marginTop="@dimen/space"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="@dimen/txt_choose"
        android:textColor="@color/black"></TextView>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_marginBottom="100dp"
        android:gravity="center"
        android:orientation="horizontal">
        <LinearLayout
            android:layout_width="@dimen/icon_loc"
            android:layout_height="match_parent"
            android:gravity="center"
            android:orientation="vertical">
            <Button
                android:id="@+id/icon_lasso"
                android:layout_width="@dimen/icon_size"
                android:layout_height="@dimen/icon_size"
                android:background="@drawable/ic_lasso"></Button>
            <TextView
                android:id="@+id/txt_lasso"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/space"
                android:text="@string/txt_lasso"
                android:textColor="@color/black"
                android:textSize="@dimen/btn_txt_size"
                ></TextView>
        </LinearLayout>
        <LinearLayout
            android:layout_width="@dimen/icon_loc"
            android:layout_height="match_parent"
            android:gravity="center"
            android:orientation="vertical">
            <Button
                android:id="@+id/icon_pen"
                android:layout_width="@dimen/icon_size"
                android:layout_height="@dimen/icon_size"
                android:background="@drawable/ic_pen"></Button>
            <TextView
                android:id="@+id/txt_pen"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/space"
                android:text="@string/txt_pen"
                android:textColor="@color/black"
                android:textSize="@dimen/btn_txt_size"
                ></TextView>
        </LinearLayout>
        <LinearLayout
            android:layout_width="@dimen/icon_loc"
            android:layout_height="match_parent"
            android:gravity="center"
            android:orientation="vertical">
            <Button
                android:id="@+id/icon_next"
                android:layout_width="@dimen/icon_size"
                android:layout_height="@dimen/icon_size"
                android:gravity="center"
                android:background="@drawable/ic_next"></Button>
            <TextView
                android:id="@+id/txt_next"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/space"
                android:text="@string/txt_next"
                android:textColor="@color/black"
                android:textSize="@dimen/btn_txt_size"
                ></TextView>
        </LinearLayout>
    </LinearLayout>
</LinearLayout>


2.file_paths.xml圖片儲存路徑

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <external-cache-path path="." name="take_photo"/>
</resources>


3.mainfest檔案

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="
    xmlns:tools="
    package="com.buildmaterialapplication">
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
        tools:ignore="ProtectedPermissions"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_car"
        android:label="@string/app_name"
        android:roundIcon="@drawable/ic_car"
        android:supportsRtl="true"
        android:theme="@style/Theme.MyApplication"
        android:requestLegacyExternalStorage="true"
        android:usesCleartextTraffic="true"
        android:hardwareAccelerated="false"
        android:largeHeap="true">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            tools:ignore="DuplicateActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <provider
            android:authorities="com.buildmaterialapplication.fileprovider"
            android:name="androidx.core.content.FileProvider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths"/>
        </provider>
    </application>
    <supports-screens android:resizeable="true" />
</manifest>


 以上就是線上直播系統原始碼,實現在圖片上塗鴉並記錄塗鴉軌跡, 更多內容歡迎關注之後的文章


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

相關文章