user427696a

Başarılı
Katılım
27 Aralık 2023
Mesajlar
226
Çözümler
1
Beğeniler
48
Bilgisayarım yok ve anlattigindan pek bir şey anlamadim link vermek yasak olduğu için mesajı buraya yazıyorum. Bu işlemi telefondan nasıl yaparim?


Kod:
There are different methods out there, but try this as a starting point:

1. Open Android Studio and create a new project. File > New > New Project > Wear OS > Blank Activity > Next > Finish

2. Convert the root layout into a SwipeDismissFrameLayout in activity_main.xml. From the file explorer on the left: app > res > layout > activity_main.xml

Code:
<?xml version="1.0" encoding="utf-8"?>
<androidx.wear.widget.SwipeDismissFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="@dimen/box_inset_layout_padding"
    tools:context=".MainActivity"
    tools:deviceIds="wear">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="@dimen/inner_frame_layout_padding"
        app:layout_boxedEdges="all">

        <TextView
            android:id="@+id/text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/hello_world" />

    </FrameLayout>
</androidx.wear.widget.SwipeDismissFrameLayout>

3. Disable SwipeToDismiss via style and theme in a resource file. app > res > values > dimens.xml

Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!--
    Because the window insets on round devices are larger than 15dp, this padding only applies
    to square screens.
    -->
    <dimen name="box_inset_layout_padding">0dp</dimen>

    <!--
    This padding applies to both square and round screens. The total padding between the buttons
    and the window insets is box_inset_layout_padding (above variable) on square screens and
    inner_frame_layout_padding (below variable) on round screens.
    -->
    <dimen name="inner_frame_layout_padding">5dp</dimen>

    <style name="AppTheme" parent="@android:style/Theme.DeviceDefault">
        <item name="android:windowSwipeToDismiss">false</item>
    </style>

</resources>

That should be all you need to get started. Once that is working, read over the code and make the necessary edits to achieve the desired result. For example, the text "Hello Round World!" is still swipeable, but the app doesn't close on a swipe, so you would need to edit the text box's attributes to prevent that from moving on a swipe. Also, check out the Google Maps example project for additional information. Keep in mind that the non-swipe to dismiss layouts are derived from the "Fragment" type of layout.
 
Burada yazdığınız şey saat için bir uygulama gibi bir şey. Bunun için bilgisayardan Android Studio indirip uygulama yapmak gerekiyor. Anladığım kadarıyla saatte sola kaydırma işlevinini kapatan bir uygulama yapmak istemişsin. Dediğim gibi telefondan yapmak mümkün değil bilgisayarda bu kodu derleyip .apk uzantılı bir dosya haline getirdikten sonra saate yükleyerek yapabilirsin.