RecordView
RecordView copied to clipboard
recordview causes recyclerview to malfunction
Hello, i have a problem with recordview when i use it with recyclerview. Turns out the recyclerview is behaving strangely. The elements of the recyclerview overlap the toolbar that I have added. This is my xml file:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F3E9DF"
tools:context=".ChatPrivado.ChatPrivadoActivity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@color/better_sharing_2_background">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageButton
android:id="@+id/btn_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:src="@drawable/ic_baseline_arrow_back_24"
app:tint="@color/white" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/image_profile"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/profile" />
<LinearLayout
android:id="@+id/btn_profile"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingStart="15dp">
<TextView
android:id="@+id/tv_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Username"
android:textColor="@android:color/white"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="last seen today at 9:00 am"
android:textColor="@android:color/white"
android:textSize="11sp" />
</LinearLayout>
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/ln_action"
android:layout_below="@+id/toolbar"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp" />
<androidx.cardview.widget.CardView
android:id="@+id/layout_actions"
android:visibility="gone"
android:layout_alignParentBottom="true"
android:layout_marginBottom="70dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
app:cardElevation="5dp"
app:cardCornerRadius="15dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:orientation="vertical">
<LinearLayout
android:layout_margin="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/btn_doc"
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="center"
android:layout_height="wrap_content"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="55dp"
android:layout_height="60dp"
android:src="@drawable/documents"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Documentos"/>
</LinearLayout>
<LinearLayout
android:id="@+id/btn_camara_m"
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="center"
android:layout_height="wrap_content"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/icons_camera"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cámara"/>
</LinearLayout>
<LinearLayout
android:id="@+id/btn_gallery"
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="center"
android:layout_height="wrap_content"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/icons_gallery" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Galería"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_margin="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/btn_audio"
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="center"
android:layout_height="wrap_content"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/audio"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Audio"/>
</LinearLayout>
<LinearLayout
android:id="@+id/btn_location"
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="center"
android:layout_height="wrap_content"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/location"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Localización"/>
</LinearLayout>
<LinearLayout
android:id="@+id/btn_contact"
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="center"
android:layout_height="wrap_content"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/contactos"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Contactos"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<LinearLayout
android:visibility="visible"
android:id="@+id/ln_action"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="1"
app:cardCornerRadius="25dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="15dp"
android:paddingTop="5dp"
android:paddingEnd="15dp"
android:background="@android:color/transparent"
android:paddingBottom="5dp">
<ImageView
android:id="@+id/btn_emoji"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="15dp"
android:src="@drawable/ic_baseline_insert_emoticon_24"
app:tint="#737373" />
<EditText
android:id="@+id/ed_message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:background="@android:color/transparent"
android:hint="Escribe algo"
android:padding="8dp" />
<ImageView
android:id="@+id/btn_file"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="15dp"
android:src="@drawable/ic_baseline_attach_file_24"
app:tint="#737373" />
<ImageView
android:id="@+id/btn_camara"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_baseline_camera_alt_24"
app:tint="#737373" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btn_sent"
android:layout_width="wrap_content"
android:layout_height="55dp"
android:layout_margin="5dp"
android:visibility="invisible"
android:src="@drawable/ic_baseline_send_24"
android:backgroundTint="@color/colorAccent"
android:tint="@android:color/white" />
</LinearLayout>
</LinearLayout>
<com.devlomi.record_view.RecordView
android:id="@+id/record_view"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@id/recyclerView"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:layout_toStartOf="@id/record_button"
app:slide_to_cancel_arrow="@drawable/recv_ic_arrow"
app:slide_to_cancel_arrow_color="@android:color/black"
app:slide_to_cancel_bounds="6dp"
app:slide_to_cancel_margin_right="5dp"
app:slide_to_cancel_text="Deslice para cancelar"
app:counter_time_color="#ff0000"/>
<com.devlomi.record_view.RecordButton
android:id="@+id/record_button"
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_below="@id/recyclerView"
android:layout_centerVertical="true"
android:layout_marginEnd="5dp"
android:layout_margin="6dp"
android:background="@drawable/recv_bg_mic"
android:backgroundTint="@color/colorAccent"
android:scaleType="centerInside"
android:visibility="visible"
android:tint="@android:color/white"
android:padding="15dp"
app:mic_icon="@drawable/recv_ic_mic"/>
</RelativeLayout>
Please, could someone help me about it?
#17
Hello 3Ilomi, I have created the class in kotlin as stated in #17, but it still doesn't work. When I create this, a new layout "custom_preview" appears in which it tells me that "android" " is invalid. Prefixed namespace bindings may not be empty". Should I add something else in this class? What could be wrong?
Please, can you help me?
Please share the code you have + the error you got
Above you can see the problem that arises.
This is my own RecyclerView:
class CustomRecyclerView : RecyclerView { constructor(context: Context?) : super(context!!) {} constructor(context: Context?, @Nullable attrs: AttributeSet?) : super(context!!, attrs) {} constructor(context: Context?, @Nullable attrs: AttributeSet?, defStyle: Int) : super( context!!, attrs, defStyle ) { }
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
val action = ev.action
when (action) {
MotionEvent.ACTION_DOWN -> super.onTouchEvent(ev)
MotionEvent.ACTION_MOVE -> return false // redirect MotionEvents to ourself
MotionEvent.ACTION_CANCEL -> super.onTouchEvent(ev)
MotionEvent.ACTION_UP -> return false
else -> {}
}
return false
}
@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(ev: MotionEvent): Boolean {
super.onTouchEvent(ev)
//Log.i("VerticalScrollview", "onTouchEvent. action: " + ev.getAction() );
return true
}
}
the xml file is the one from the first post but changing recylerView to the name of my own recyclerView.
What should I add in my own recyclerView to fix the error?
Can you help me please?
Send me a demo project so I can look into it.
@3llomi have you resolved this issue ??
Can you help me please?
did you find any solution?
@hami9872 Did you test the solution mentioned above? Can you send me a sample Project so I can look into it?
@hami9872 Did you test the solution mentioned above? Can you send me a sample Project so I can look into it?
Here is the demo project when I use recycler view with this Library layouts overlap as @bettersharing mentioned before. My Application.zip
@hami9872 I need fully working demo that demonstrates the issue please. I can't find the issue in the app you sent.