前提・実現したいこと
マウスドラッグでtextviewを移動させること。
ここに質問の内容を詳しく書いてください。
https://codinginflow.com/tutorials/android/simple-recyclerview-java/part-1-layouts-model-class
この動画の4:14のようにtextviewをマウスでドラッグして移動したいのですが、動画と同じコードを書いてもtextviewが左上に勝手に戻ってしまいます。
発生している問題・エラーメッセージ
エラーメッセージ
該当のソースコード
https://codinginflow.com/tutorials/android/simple-recyclerview-java/part-1-layouts-model-class
ここにコードは全部のっています。
<?xml version="1.0" encoding="utf-8"?>XML ソースコード
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="4dp">
<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="4dp"> <ImageView android:id="@+id/imageView" android:layout_width="50dp" android:layout_height="50dp" android:padding="2dp" /> <TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_toEndOf="@+id/imageView" android:text="Line 1" android:textColor="@android:color/black" android:textSize="20sp" android:textStyle="bold" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/textView" android:layout_marginStart="8dp" android:layout_toEndOf="@+id/imageView" android:text="Line 2" android:textSize="15sp" /> </RelativeLayout>
</android.support.v7.widget.CardView>
試したこと
動画通りにしました。
ここに問題に対して試したことを記載してください。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
あなたの回答
tips
プレビュー