How can I remove the horizontal line below the fields(red)?
Also i want to know, how i can insert an horizontal line between the categories(blue)?
settings.xml
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory
android:title="#string/pref_ankunft_abflug"
android:layout="#layout/styles1">
<com.example.world.DatePickerPreference
android:key="prefVon"
android:layout="#layout/styles1"
android:summary="#string/pref_datum_von" />
<com.example.world.DatePickerPreference
android:key="prefBis"
android:layout="#layout/styles1"
android:summary="#string/pref_datum_bis"/>
<com.example.world.DatePickerPreference
android:key="prefBis"
android:layout="#layout/styles1"
android:summary="#string/pref_datum_bis"/>
</PreferenceCategory>
<PreferenceCategory>
<Preference
android:layout_width="fill_parent"
android:layout_height="5dip"
android:background="#color/texte" />
<ListPreference
android:defaultValue="10"
android:entries="#array/Vorschläge"
android:entryValues="#array/VorschlägeValues"
android:key="prefUmkreis"
android:layout="#layout/styles1"
android:summary="#string/pref_umkreis_titel"
android:title="#string/pref_umkreis"/>
</PreferenceCategory>
</PreferenceScreen>
styles1.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:id="#+android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginLeft="20dp"
android:textSize="21sp"
android:textStyle="bold"
android:textColor="#color/ueberschrift"/>
<TextView android:id="#+android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="21sp"
android:layout_marginLeft="20dp"
android:textColor="#color/texte"/>
</LinearLayout>
Picture:
http://www.directupload.net/file/d/3629/h4kczzxv_png.htm
Related
Accessibility talkback skipping some of the items in RecyclerView with the Staggered layout manager.
Steps to reproduce the issue:
Run the project on any device (Verified in Samsung s10)
Enable Accessibility talkback in the device. Settings->Accessibility->Screen Reader->Voice Assistant
Do forward accessibility on the recycler view
Observe Some of the items are skipped
Recycler layout file:
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 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:id="#+id/nestedScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAccessibility="no"
android:orientation="horizontal">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/page_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:nestedScrollingEnabled="true"
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
Recycler Layout file:
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:padding="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:orientation="vertical">
<TextView
android:id="#+id/item_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:textAppearance="#style/TextAppearance.Material3.TitleMedium" />
<androidx.appcompat.widget.AppCompatImageView
android:id="#+id/item_image"
android:layout_width="200dp"
android:layout_height="200dp"
android:scaleType="fitCenter" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
Find Screenshot here:
https://i.stack.imgur.com/yUEFp.jpg
Sample project and screen record available here:
https://issuetracker.google.com/issues/255525862
I have a youtube-like MotionLayout and I have problems to make it work as I want.
As in the pictures below I want to drag/swipe only on the main_container and not the whole screen (this 2 pictures showing my to states of the MotionLayout) - this is working with touchRegionId.
But I also want to click something in my main_container:
In the end state I want to click play/pause and close
In the start state I want to use my exoplayer and his controls
And my question is how can I achieve that.
This is my end state:
This is my start state:
My motion-scene (only Transition):
<Transition
motion:constraintSetEnd="#+id/end"
motion:constraintSetStart="#id/start"
motion:duration="1000">
<KeyFrameSet>
<KeyAttribute
motion:motionTarget="#+id/close_imageView"
motion:framePosition="90"
android:alpha="0" />
<KeyAttribute
motion:motionTarget="#+id/play_imageView"
motion:framePosition="90"
android:alpha="0" />
<KeyAttribute
motion:motionTarget="#+id/title_textView"
motion:framePosition="95"
android:alpha="0" />
</KeyFrameSet>
<OnSwipe
motion:touchRegionId="#id/main_container"
motion:dragDirection="dragDown"
motion:nestedScrollFlags="disableScroll" />
</Transition>
And my activity_main.xml (without the whole NestedScrollView below the main_container from start state):
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.motion.widget.MotionLayout 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:id="#+id/motion_layout_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutDescription="#xml/activity_main_scene"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="MissingConstraints">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
app:menu="#menu/toolbar_menu">
<ImageView
android:id="#+id/icon"
android:layout_width="60dp"
android:layout_height="55dp"
android:adjustViewBounds="true"
android:background="#drawable/icons8_youtube_192___" />
<TextView
android:id="#+id/youtube_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="YouTubeClone"
android:textColor="#color/black"
android:textSize="20sp"
android:textStyle="bold"
android:gravity="center"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/user_profile_imageview"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:src="#drawable/ic_baseline_account_circle_24" />
</RelativeLayout>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<androidx.fragment.app.FragmentContainerView
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_above="#+id/bottom_navigation"
app:layout_constraintBottom_toTopOf="#+id/bottom_navigation"
app:layout_constraintTop_toBottomOf="#+id/appBar" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
app:itemIconTint="#color/black"
app:itemRippleColor="#color/cardview_dark_background"
app:itemTextColor="#color/black"
app:labelVisibilityMode="labeled"
app:layout_constraintBottom_toBottomOf="parent"
app:menu="#menu/bottom_menu" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/main_container"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="#color/colorDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.exoplayer2.ui.PlayerView
android:id="#+id/player_main"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#android:color/background_dark"
android:scaleType="centerCrop"
app:controller_layout_id="#layout/exoplayer_controller"
app:layout_constraintBottom_toBottomOf="#id/main_container"
app:layout_constraintStart_toStartOf="#id/main_container"
app:layout_constraintTop_toTopOf="#id/main_container"
app:player_layout_id="#layout/exo_player_view"
app:use_controller="true" />
<ProgressBar
android:id="#+id/progress_bar_main"
android:layout_width="60dp"
android:layout_height="60dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="#id/main_container"/>
<ImageView
android:id="#+id/close_imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:alpha="0"
app:layout_constraintBottom_toBottomOf="#id/main_container"
app:layout_constraintEnd_toEndOf="#id/main_container"
app:layout_constraintTop_toTopOf="#id/main_container"
app:srcCompat="#drawable/ic_baseline_close_24"/>
<ImageView
android:id="#+id/play_imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:alpha="0"
app:layout_constraintBottom_toBottomOf="#+id/close_imageView"
app:layout_constraintEnd_toStartOf="#+id/close_imageView"
app:layout_constraintTop_toTopOf="#+id/close_imageView"
app:srcCompat="#drawable/ic_baseline_play_arrow_24_white"
app:tint="#color/black" />
<TextView
android:id="#+id/title_textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="12dp"
android:alpha="0"
android:ellipsize="end"
android:maxLines="1"
app:layout_constraintBottom_toBottomOf="#+id/play_imageView"
app:layout_constraintEnd_toStartOf="#+id/play_imageView"
app:layout_constraintStart_toEndOf="#+id/player_main"
app:layout_constraintTop_toTopOf="#+id/play_imageView" />
</androidx.constraintlayout.motion.widget.MotionLayout>
My findViewById is not working. it does not link...
////my fragment.contacts.xml
*<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity">
<EditText
android:id="#+id/txtShowOnMap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:contentDescription="#string/locationonmap"
android:importantForAutofill="no"
android:inputType="text"
android:labelFor="#id/btnShowOnMap"
android:minHeight="48dp"
android:text="#string/store_location" />
<Button
android:id="#+id/btnShowOnMap"
android:layout_width="395dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="#string/map" />
</LinearLayout>*
////end of fragmentcontacts.xml
my contactsfragment.kt
Please Make it view.findViewById
For fragment you need to add rootview.
I have RecyclerView with the following layout for items:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="?android:attr/selectableItemBackground"
android:gravity="center">
<LinearLayout
android:id="#+id/name_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:transitionName="#string/transition_name_details">
<TextView
android:id="#+id/name"
style="#style/input_text_style"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:textColor="#color/primaryTextColor"/>
</LinearLayout>
When clicked on an item an activity is shown with the following layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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="match_parent"
android:fitsSystemWindows="true">
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="15dp"
android:clipToPadding="false"
android:paddingBottom="80dp"
android:scrollbars="vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior"/>
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
app:elevation="0dp">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="15dp"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:transitionName="#string/transition_name_details">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/name"
style="#style/input_text_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/name"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLines="1"
/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>...
Unfortunately the value of the TextInputEditText is not showing when the second activity is displayed. But when I click on the TextInputEditText the value is then displayed.
Changing the first layout to this one solved the problem:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/name_layout"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="?android:attr/selectableItemBackground"
android:gravity="center"
android:transitionName="#string/transition_name_details">
<TextView
android:id="#+id/name"
style="#style/input_text_style"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:textColor="#color/primaryTextColor"/>
</RelativeLayout>
I just released my app using Material design patterns, am essentially using the out of box DrawerLayout/Nav and CardView/RecyclerView.
Here's the App if you want to try: https://play.google.com/store/apps/details?id=com.cp2.start.and.play.music.player , Works on all my devices but users report on Samsung S7 not so much
Here's the definitions:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="#+id/allotherelements"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context=".MainCardActivity"
tools:showIn="#layout/app_bar_main_card">
<android.support.v7.widget.RecyclerView
android:id="#+id/device_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:layout_below="#+id/textView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
Than insert Cards using:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:animateLayoutChanges="true"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
card_view:cardCornerRadius="4dp"
android:layout_margin="3dp"
card_view:contentPadding="5dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_toLeftOf="#+id/imageButton"
android:layout_toStartOf="#+id/imageButton">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New CheckBox"
android:id="#+id/checkBox" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:focusableInTouchMode="false">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Volume"
android:id="#+id/volumeText"
android:layout_marginBottom="5dp"
android:layout_marginTop="10dp" />
<SeekBar
android:id="#+id/volumeslider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:max="15"
android:layout_marginTop="10dp" />
</LinearLayout>
</LinearLayout>
<ImageButton
android:id="#+id/imageButton"
android:layout_width="52dp"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:background="#android:color/background_light"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
The Adapter and and all are working fine on my Nexus 5, and OLD Asus tablet(on android 4.3).
My user reported an empty screen. Has anyone heard of Samsung 7 having issues with RecyclerView or CardView