I have a question.
Why android:elevation doesn't show shadows? I am making shadows first time
Only used in ImageButton it's working (when I use with android:background it isn't working)
This is my code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:text="TestBTT"
android:layout_width="295dp"
android:layout_height="41dp"
android:padding="10dp"
android:elevation="30dp"
android:outlineProvider="bounds"
android:background="#drawable/przycisk"
android:id="#+id/button2" android:layout_marginTop="60dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="72dp"/>
<ImageButton
android:layout_width="247dp"
android:layout_height="61dp"
android:id="#+id/imageButton" android:layout_marginTop="188dp"
android:elevation="20dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="72dp" android:cropToPadding="true" android:adjustViewBounds="true"/>
<TextView
android:text="TextView"
android:elevation="40dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView" android:textSize="24sp"
android:layout_marginTop="360dp" app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="196dp"
app:layout_constraintStart_toStartOf="parent"/>
What to do to make the shadows appear under the button?
And what to do to show up under the button where is android: background?
The default Button style under Material has a StateListAnimator
that controls the android:elevation and android:translationZ
properties.
copied from here
just add this property to your Button. you can set your own using the android:stateListAnimator property.
android:stateListAnimator="#null"
full code :
<Button
android:id="#+id/my_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dp"
android:elevation="2dp"
android:translationZ="2dp"
android:stateListAnimator="#null"
android:background="#android:color/holo_green_light"
android:text="BUTTON">
UpDate :
for Understanding I set it 10dp..
xml code :
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp">
<Button
android:id="#+id/my_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dp"
android:elevation="10dp"
android:translationZ="10dp"
android:stateListAnimator="#null"
android:background="#android:color/holo_green_light"
android:text="BUTTON"/>
</RelativeLayout>
Related
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
tools:context=".HomeList.HomeListAdapter"
android:layout_margin="20dp">
<ImageView
android:id="#+id/image"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="30dp"
android:background="#drawable/radius_product"
android:elevation="5dp"/>
<ImageView
android:id="#+id/imageView"
android:layout_width="140dp"
android:layout_height="70dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="40dp"
android:background="#drawable/radius_white" />
<TextView
android:id="#+id/productName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginBottom="68dp"
android:fontFamily="#font/ibmplexsanskr_regular"
android:text="product"
android:textColor="#color/black"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.091"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="46dp"
android:text="₩"
android:textColor="#F57154"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.133"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="#+id/price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginBottom="37dp"
android:fontFamily="#font/ibmplexsanskr_regular"
android:text="dsdsdsds"
android:textColor="#F57154"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.258"
app:layout_constraintStart_toStartOf="parent" />
</FrameLayout>
I'm making xml of list-adapter item using Framelayout in Android Studio and I want to make it like pic1.
pic1
But I think it doesn't work. Because I can't bring product name or price in front of product image. And it works like this pic2.
pic2
I know that textView(id:price) would be the most recent child on top of the stack but it doesn't work.
I think it's because you have set android:elevation in your first ImageView. You either need to set a higher elevation for your TextViews, or remove the elevation if it's not necessary.
Hello I am trying to put two buttons next to eachother in android studio with linearlayout:
<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"
android:gravity="center"
tools:context=".MainActivity">
<ImageView
android:id="#+id/imageView"
android:layout_width="222dp"
android:layout_height="237dp"
app:srcCompat="#drawable/ic_launcher_background"
tools:layout_editor_absoluteX="246dp"
tools:layout_editor_absoluteY="322dp" />
<com.google.android.material.button.MaterialButton
android:id="#+id/cameraBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/camera"
android:layout_marginTop="8dp"
app:strokeColor="#color/teal_700"
app:cornerRadius="100dp"
style="#style/Widget.MaterialComponents.Button.OutlinedButton"/>
<com.google.android.material.button.MaterialButton
android:id="#+id/galleryBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Gallery"
android:layout_marginTop="8dp"
app:cornerRadius="100dp"
style="#style/Widget.MaterialComponents.Button.OutlinedButton"
/>
the output currently is:
I have tried with relativelayout - didn't work and also using horizontal in linearlayout.
I have tried putting also the android:layout_weight as 1 and the buttons disappeared.
I want to have the imageview in the center and the two buttons below and the two buttons are next to each other.
You can use another Linear Layout inside the parent layout and set its orientation to horizontal to achieve the desired output.
Code For Desired Output:
<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:gravity="center"
android:orientation="vertical"
tools:context=".MainActivity">
<ImageView
android:id="#+id/imageView"
android:layout_width="222dp"
android:layout_height="237dp"
app:srcCompat="#drawable/ic_launcher_background"
tools:layout_editor_absoluteX="246dp"
tools:layout_editor_absoluteY="322dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center"
android:gravity="center">
<com.google.android.material.button.MaterialButton
android:id="#+id/cameraBtn"
style="#style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_gravity="center"
android:gravity="center"
android:text="#string/camera"
app:cornerRadius="100dp"
app:strokeColor="#color/teal_700" />
<com.google.android.material.button.MaterialButton
android:id="#+id/galleryBtn"
style="#style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:text="Gallery"
app:cornerRadius="100dp" />
</LinearLayout>
In your current layout, all the elements are in one container, that is your LinearLayout.
One idea to achieve what you want with a LinearLayout is to separate the image and buttons in 2 different LinearLayouts.
The orientation of the LinearLayout that will host your buttons should be horizontal.
<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:gravity="center"
android:orientation="vertical"
tools:context=".MainActivity">
<ImageView
android:id="#+id/imageView"
android:layout_width="222dp"
android:layout_height="237dp"
app:srcCompat="#drawable/ic_launcher_background"
tools:layout_editor_absoluteX="246dp"
tools:layout_editor_absoluteY="322dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="#+id/cameraBtn"
style="#style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="#string/camera"
app:cornerRadius="100dp"
app:strokeColor="#color/teal_700" />
<com.google.android.material.button.MaterialButton
android:id="#+id/galleryBtn"
style="#style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Gallery"
app:cornerRadius="100dp" />
</linearLayout>
</LinearLayout>
If the LinearLayout isn't a hard requirement, I would suggest to use ConstraintLayout. By using that, you can position everything in a much better and easy way.
You need to use another linear layout to put two button besides each other,
Here is the code for this.
<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:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/imageView"
android:layout_width="222dp"
android:layout_height="237dp"
app:srcCompat="#drawable/ic_launcher_background"
tools:layout_editor_absoluteX="246dp"
tools:layout_editor_absoluteY="322dp" />
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
android:id="#+id/cameraBtn"
style="#style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:gravity="center"
android:text="Camera"
app:cornerRadius="100dp"
app:strokeColor="#color/teal_700" />
<com.google.android.material.button.MaterialButton
android:id="#+id/galleryBtn"
style="#style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:text="Gallery"
app:cornerRadius="100dp" />
</androidx.appcompat.widget.LinearLayoutCompat>
</LinearLayout>
Here is the screenshot of the desired output.
you can give desired margins to set the buttons in the layout.
If you are intending to keep this view inside of a LinearLayout this is how you will do it. You will add a new LinearLayout below your ImageView and set its orientation or horizontal. Then add your buttons inside of that LinearLayout.
<?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"
android:gravity="center"
tools:context=".MainActivity">
<ImageView
android:id="#+id/imageView"
android:layout_width="222dp"
android:layout_height="237dp"
app:srcCompat="#drawable/ic_launcher_background" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="#+id/cameraBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/camera"
android:layout_marginTop="8dp"
app:strokeColor="#color/teal_700"
app:cornerRadius="100dp"
style="#style/Widget.MaterialComponents.Button.OutlinedButton"/>
<com.google.android.material.button.MaterialButton
android:id="#+id/galleryBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Gallery"
android:layout_marginTop="8dp"
app:cornerRadius="100dp"
style="#style/Widget.MaterialComponents.Button.OutlinedButton"
/>
</LinearLayout>
</LinearLayout>
If you are interested in using ConstraintLayout this is how you would do it:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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"
android:gravity="center"
tools:context=".MainActivity">
<ImageView
android:id="#+id/imageView"
android:layout_width="222dp"
android:layout_height="237dp"
app:srcCompat="#drawable/ic_launcher_background"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<com.google.android.material.button.MaterialButton
android:id="#+id/cameraBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/camera"
android:layout_marginTop="8dp"
app:strokeColor="#color/teal_700"
app:cornerRadius="100dp"
style="#style/Widget.MaterialComponents.Button.OutlinedButton"
app:layout_constraintTop_toBottomOf="#+id/imageView"
app:layout_constraintEnd_toStartOf="#+id/galleryBtn"
app:layout_constraintStart_toStartOf="parent"/>
<com.google.android.material.button.MaterialButton
android:id="#+id/galleryBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Gallery"
android:layout_marginTop="8dp"
app:cornerRadius="100dp"
style="#style/Widget.MaterialComponents.Button.OutlinedButton"
app:layout_constraintTop_toBottomOf="#+id/imageView"
app:layout_constraintStart_toEndOf="#+id/cameraBtn"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
The outer (main) layout has a vertical orientation, so all the elements inside this layout will be arranged vertically, So in order to have these two buttons next to each other you have to use inner
linearlayout (inside the main layout) and set its 'orientation' to horizontal.
I am trying to make a recyclerView where each of the items in the list will show an imageView with 2 buttons on the right of the imageview. I have tried but not really getting there. Some help would be really great.
Here is what i want:
What i tried:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="wrap_content">
<ImageView
android:id="#+id/imgVw_contact"
android:layout_width="0dp"
android:layout_height="#dimen/album_cover_height_details"
android:layout_margin="5dp"
android:layout_marginStart="4dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="4dp"
android:layout_marginBottom="8dp"
android:clickable="true"
android:scaleType="fitXY"
android:src="#mipmap/ic_launcher"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/txtVw_contactName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/imgVw_contact"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:gravity="center"
android:text="myColors"
android:textColor="#color/album_title"
android:textSize="#dimen/album_title"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imgVw_contact" />
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#drawable/ic_newok"
app:layout_constraintBottom_toBottomOf="#+id/imgVw_contact"
app:layout_constraintEnd_toEndOf="#+id/imgVw_contact"
app:layout_constraintHorizontal_bias="0.931"
app:layout_constraintStart_toStartOf="#+id/imgVw_contact"
app:layout_constraintTop_toTopOf="#+id/imgVw_contact"
app:layout_constraintVertical_bias="0.409" />
</android.support.constraint.ConstraintLayout>
and the result is:
I cant find a reason for why the images are getting round.
Also I have tried to use a drawable for button background but no matter what i create either new image asset or vector asset it becomes huge when i use it as background(as you can see in the screenshot).
Here is the design you need using ConstrainLayout -
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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/relativeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imgVw_contact"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:clickable="true"
android:scaleType="fitXY"
android:src="#mipmap/ic_launcher"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/txtVw_contactName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="8dp"
android:gravity="center"
android:text="myColors"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/imgVw_contact" />
<Button
android:layout_marginTop="8dp"
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_clear_black_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#id/btn"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_check_circle_black_24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
The corresponding layout image is -
Ok I got it. I found out the reasons behind my issues.
issue 1: There is a ic_launcher.xml(anydpi) inside mipmap which is a round cornered one. So when I was setting ic_launcher as background it takes this one .
issue 2: the images used inside the buttons get the full height width of button and becomes huge.
I have see your layout . and try to make it . Here is the code
Try this
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="200dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="#drawable/house1" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentRight="true"
android:paddingRight="5dp"
android:layout_centerVertical="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_highlight_off_black_24dp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_vpn_key_black_24dp"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
I have a dialogfragment with an autocomplete textview in an alertDialog. As the title does not layout according to my style I added a textView to show the title in my custom layout. Next thing I noticed that the dropdownlist from the autocomplete no longer anchors to the autocomplete but to the title textView instead. Image on the left. Removing the textView solves the placement. Image on the right.
Setting the anchor with android:dropDownAnchor does not solve the issue.
Setting the title within the alertDialog keeps white space around the orangebar. See this question. And removing the title is no option.
My layout file is shown below:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="0dp"
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView
android:id="#+id/txt_dialogtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="#string/overlayschedulepickerdialog_title"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
style="#style/ScheduleCompareDialogTitle"/>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="#+id/txt_dialogtitle"
app:layout_constraintBottom_toBottomOf="parent">
<RadioGroup
android:id="#+id/radiogroup_main_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toTopOf="parent">
<RadioButton
android:id="#+id/radio_teachers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Docenten" />
<RadioButton
android:id="#+id/radio_locations"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lokalen" />
</RadioGroup>
<RadioGroup
android:id="#+id/radiogroup_main_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintLeft_toRightOf="#id/radiogroup_main_left"
app:layout_constraintTop_toTopOf="#id/radiogroup_main_left">
<RadioButton
android:id="#+id/radio_students"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Leerlingen" />
<RadioButton
android:id="#+id/radio_groups"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Groepen" />
</RadioGroup>
<CheckBox
android:id="#+id/check_own_properties"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Alleen eigen leerlingen/groepen"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/radiogroup_main_right"
app:layout_constraintStart_toStartOf="#id/radiogroup_main_left" />
<RadioGroup
android:id="#+id/radiogroup_branches"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="#id/check_own_properties"
app:layout_constraintTop_toTopOf="#id/radiogroup_main_left"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginLeft="16dp"
>
</RadioGroup>
<AutoCompleteTextView
android:id="#+id/acl_textinput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:hint="Zoeknaam"
app:layout_constraintTop_toBottomOf="#id/check_own_properties"
app:layout_constraintLeft_toLeftOf="#id/check_own_properties"
android:layout_marginLeft="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="20dp"
android:dropDownHeight="150dp"
android:inputType="textNoSuggestions"/>
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
BTW, on my real device running Nougat the dropdownlist is anchored perfectly but not on the emulator running nougat or pie.
I need to set text for a LottieAnimationView, but the documentation isn't helping me much
I tried adding a text view on the layout, but it doesn't seem to do anything.
<com.airbnb.lottie.LottieAnimationView
android:background="#color/trans_100"
android:id="#+id/animation_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/text_value"
android:textSize="20sp"
android:layout_gravity="center"
/>
I don't think you can put a text in the animation because is like an image (you don't have the source for edit this).
However, if you use relative or constraintlayout you can do the trick by using:
In relative layout:
<TextView
android:paddingTop="-10dp"
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/text_value"
android:textSize="20sp"
android:layout_gravity="center" />
In constraintlayout:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="350dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_gravity="center"
android:layout_height="match_parent">
<com.airbnb.lottie.LottieAnimationView
android:background="#color/trans_100"
android:id="#+id/animation_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:paddingTop="10dp"
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/text_value"
android:textSize="20sp"
android:layout_gravity="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#null"
app:textAllCaps="false" />
</androidx.constraintlayout.widget.ConstraintLayout>
Right now i am doing a test with the information a gave you with a Lottie Animation I am working in ConstraintLayout a this is the result: