Can I use a Flow helper with RadioButtons? - android

I found the following post on SO regarding constraint layout flow helpers ConstraintLayout Flow helper example and wondered if they could be used with radio buttons.
I can find little about using flow helpers anywhere.
I tried adding the following to my layout inside the RadioGroup.
<androidx.constraintlayout.helper.widget.Flow
android:id="#+id/flow1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="10dp"
app:constraint_referenced_ids="radioButton, radioButton2, radioButton3"
app:flow_horizontalBias="0"
app:flow_horizontalGap="10dp"
app:flow_horizontalStyle="packed"
app:flow_verticalBias="0"
app:flow_wrapMode="chain"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
When I try to run the app I get the following errors:
Android resource linking failed
C:\AndroidProjects\MyApp\app\src\main\res\layout\activity_main.xml:158: error: attribute flow_horizontalBias (aka com.domain.myapp:flow_horizontalBias) not found.
C:\AndroidProjects\MyApp\app\src\main\res\layout\activity_main.xml:158: error: attribute flow_horizontalGap (aka com.domain.myapp:flow_horizontalGap) not found.
C:\AndroidProjects\MyApp\app\src\main\res\layout\activity_main.xml:158: error: attribute flow_horizontalStyle (aka com.domain.myapp:flow_horizontalStyle) not found.
C:\AndroidProjects\MyApp\app\src\main\res\layout\activity_main.xml:158: error: attribute flow_verticalBias (aka com.domain.myapp:flow_verticalBias) not found.
C:\AndroidProjects\MyApp\app\src\main\res\layout\activity_main.xml:158: error: attribute flow_wrapMode (aka com.domain.myapp:flow_wrapMode) not found.
error: failed linking file resources.

Use constraintlayout:2.0.0-alpha5 in gradle
Refer Flow

Yes, you can use ConstraintLayout (and Flow) to arrange RadioButton, but you have to use a ConstraintLayout aware RadioGroup widget to manage RadioButton widgets.
Please visit https://github.com/samlu/ConstraintRadioGroup.
The blRadioGroup widget should be what you are looking for.

Related

Android resource linking failed datetimepicker attrs not found

there is a ton of questions pertaining to this type of exception an i really dont get how it came about. I guess the exception is telling me that there are a bunch of date picker attributes that it expected to find in the styles file of my app that it could not find and I do not understand why as I swear exactly the same code was compiling flawlessly a few months back. What I dont inderstand is why its even looking for those in my project folder all those attrs are actually found and well defined on the values file where the exception stems from. all suggestions such as cleaning and rebuilding or upgrading to androidx have not worked. this is so vexing
AAPT: C:\Users\theo\Desktop\GymLog_App\GymLogMulti\app\build\intermediates\incremental\mergeGenericVersionDebugResources\merged.dir\values\values.xml:3535: error: style attribute 'attr/minDate (aka com.example.android.gymlogmulti.generic:attr/minDate)' not found.
C:\Users\theo\Desktop\GymLog_App\GymLogMulti\app\build\intermediates\incremental\mergeGenericVersionDebugResources\merged.dir\values\values.xml:3536: error: style attribute 'attr/maxDate (aka com.example.android.gymlogmulti.generic:attr/maxDate)' not found.
C:\Users\theo\Desktop\GymLog_App\GymLogMulti\app\build\intermediates\incremental\mergeGenericVersionDebugResources\merged.dir\values\values.xml:3544: error: style attribute 'attr/weekDayTextAppearance (aka com.example.android.gymlogmulti.generic:attr/weekDayTextAppearance)' not found.
C:\Users\theo\Desktop\GymLog_App\GymLogMulti\app\build\intermediates\incremental\mergeGenericVersionDebugResources\merged.dir\values\values.xml:3545: error: style attribute 'attr/dateTextAppearance (aka com.example.android.gymlogmulti.generic:attr/dateTextAppearance)' not found.
C:\Users\theo\Desktop\GymLog_App\GymLogMulti\app\build\intermediates\incremental\mergeGenericVersionDebugResources\merged.dir\values\values.xml:3551: error: style attribute 'attr/datePickerMode (aka com.example.android.gymlogmulti.generic:attr/datePickerMode)' not found.
C:\Users\theo\Desktop\GymLog_App\GymLogMulti\app\build\intermediates\incremental\mergeGenericVersionDebugResources\merged.dir\values\values.xml:3552: error: style attribute 'attr/dtp_legacyLayout (aka com.example.android.gymlogmulti.generic:attr/dtp_legacyLayout)' not found.
C:\Users\theo\Desktop\GymLog_App\GymLogMulti\app\build\intermediates\incremental\mergeGenericVersionDebugResources\merged.dir\values\values.xml:3553: error: style attribute 'attr/calendarViewShown (aka com.example.android.gymlogmulti.generic:attr/calendarViewShown)' not found.
C:\Users\theo\Desktop\GymLog_App\GymLogMulti\app\build\intermediates\incremental\mergeGenericVersionDebugResources\merged.dir\values\values.xml:3638: error: style attribute 'attr/weekDayTextAppearance (aka com.example.android.gymlogmulti.generic:attr/weekDayTextAppearance)' not found.
C:\Users\theo\Desktop\GymLog_App\GymLogMulti\app\build\intermediates\incremental\mergeGenericVersionDebugResources\merged.dir\values\values.xml:3639: error: style attribute 'attr/dateTextAppearance (aka com.example.android.gymlogmulti.generic:attr/dateTextAppearance)' not found.
C:\Users\theo\Desktop\GymLog_App\GymLogMulti\app\build\intermediates\incremental\mergeGenericVersionDebugResources\merged.dir\values\values.xml:3644: error: style attribute 'attr/datePickerMode (aka com.example.android.gymlogmulti.generic:attr/datePickerMode)' not found.
I just found the source of the issue by using CTRL+SHIFT+F and looking for the problematic attributes in the code (of the entire scope). Turns out the culprit was a third party dependency. Once i uninstalled it it was fixed. I guess the issue came from updating gradle and these outdated libraries somehow interfering with it.
I still dont understand the nature of the issue exactly but I hope this helps someone else dealing with the same issue. I just spent waaay to long looking at this.

Android resource linking failed when using layout_gravity="bottom||end" xml

I tried to put my FAB on the Bottom right side of the screen. But every time I build the app, it always fail with AAPT error if I'm using the android:layout_gravity="bottom||end"
Here is the detailed error:
Android resource linking failed
AAPT: error: 'bottom||end' is incompatible with attribute layout_gravity (attr) flags [bottom=80, center=17, center_horizontal=1, center_vertical=16, clip_horizontal=8, clip_vertical=128, end=8388613, fill=119, fill_horizontal=7, fill_vertical=112, left=3, right=5, start=8388611, top=48].
And I've tried to use android:layout_gravity="bottom" and it works just fine.
can someone help me with this?
Use
android:layout_gravity="bottom|end"
instead of
android:layout_gravity="bottom||end"

Android resource linking failed chat21

I am trying to add chat21 API to my project but facing an error "Android resource linking failed"
I have tried looking at resource files for any errors as well as looking as similar posts but none of them helped me in this case
Android resource linking failed warn: removing resource
com.example.bartertrade:string/activity_public_profile_presence_not_available
without required default value.
/Users/neha/.gradle/caches/transforms-2/files-2.1/bc7291a5f042de9d7c80c9df50272833/res/layout/layout_custom_notification.xml:29:
error: resource style/TextAppearance.AppCompat.Notification.Title (aka
com.example.bartertrade:style/TextAppearance.AppCompat.Notification.Title)
not found.
error: failed linking file resources.
<RelativeLayout
android:id="#+id/box_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="#id/image">
<TextView
android:id="#+id/title"
style="#style/TextAppearance.AppCompat.Notification.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_toStartOf="#+id/time"
android:maxLength="20"
android:maxLines="1" />
<TextView
android:id="#+id/time"
style="#style/TextAppearance.AppCompat.Notification.Time"
android:layout_width="100dp"
android:layout_marginTop="2dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:gravity="end" />
</RelativeLayout>
"Android resource linking failed" this error will delete your R.Java which contains your linking data, it occurs when some error have in the XML file.
Try to find the error on your XML file.
I guess you added style="#style/TextAppearance.AppCompat.Notification.Title" this , which is not supported.
I am trying to add chat21 API to my project but facing an error "Android resource linking failed"
I have tried looking at resource files for any errors as well as looking as similar posts but none of them helped me in this case
Android resource linking failed warn: removing resource com.example.bartertrade:string/activity_public_profile_presence_not_available without required default value. /Users/neha/.gradle/caches/transforms-2/files-2.1/bc7291a5f042de9d7c80c9df50272833/res/layout/layout_custom_notification.xml:29: error: resource style/TextAppearance.AppCompat.Notification.Title (aka com.example.bartertrade:style/TextAppearance.AppCompat.Notification.Title) not found.
And you can see that program could not find the that particular thing
. When you remove these lines from your XML file. Then your problem
will fix.

Android: importing projects/libraries?

I am trying to use code from a project that I downloaded from Github, however I am consistently getting errors.
Is there more steps needed to use a project than importing it into eclipse?
I am currently just copying and pasting code from the downloaded project to mine.
Attempting to use the following:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.mikhaellopez.circularimageviewsample"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical" >
<com.mikhaellopez.circularimageview.CircularImageView
android:layout_width="250dp"
android:layout_height="250dp"
android:src="#drawable/image"
app:border="true"
app:border_color="#color/GrayLight"
app:border_width="4dp"
app:shadow="true" />
</LinearLayout>
But getting the error:
Multiple annotations found at this line:
- error: No resource identifier found for attribute 'border_color' in package
'com.mikhaellopez.circularimageviewsample'
- error: No resource identifier found for attribute 'shadow' in package
'com.mikhaellopez.circularimageviewsample'
- error: No resource identifier found for attribute 'border' in package
'com.mikhaellopez.circularimageviewsample'
- error: No resource identifier found for attribute 'border_width' in package
'com.mikhaellopez.circularimageviewsample'
Is there more steps needed to use a project than importing it into eclipse?
Well, that depends.
I am currently just copying and pasting code from the downloaded project to mine.
Depending upon how that code is written, that may not work well.
But getting the error:
Change:
xmlns:app="http://schemas.android.com/apk/res/com.mikhaellopez.circularimageviewsample"
to:
xmlns:app="http://schemas.android.com/apk/res-auto"
as your app does not have the package name of com.mikhaellopez.circularimageviewsample, apparently.

error: No resource identifier found for attribute in custom-views from http://developer.android.com

I'm learning to develop android applications following the tutorial in http://developer.android.com.
Now I'm working on http://developer.android.com/training/custom-views/create-view.html and when I build the application I get the errors:
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'showText' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'labelHeight' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'labelWidth' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'labelY' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'labelPosition' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'highlightStrength' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'pieRotation' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'labelColor' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'autoCenterPointerInSlice' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'pointerRadius' in package 'com.example.android.customviews.charting'
I downloaded the code from the website and I installed it as it is, without any change so the main.xml is
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res/com.example.android.customviews"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.example.android.customviews.charting.PieChart
android:id="#+id/Pie"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_weight="100"
custom:showText="true"
custom:labelHeight="20dp"
custom:labelWidth="110dp"
custom:labelY="85dp"
custom:labelPosition="left"
custom:highlightStrength="1.12"
android:background="#android:color/white"
custom:pieRotation="0"
custom:labelColor="#android:color/black"
custom:autoCenterPointerInSlice="true"
custom:pointerRadius="4dp"
/>
<Button
android:id="#+id/Reset"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/reset_button"
/>
</LinearLayout>
and namespaces are the same.
Can you help me to understand why I'm getting these errors?
Thanks a lot.
I also had the same problem and the answer is in this link.
In short, you need to replace
http://schemas.android.com/apk/res/com.example.android.customviews
with
http://schemas.android.com/apk/lib/com.example.android.customviews
Namely, /res/ to /lib/.
I downloaded the same custom-demo from Android.com, and had the same problem.
Changing
xmlns:custom="http://schemas.android.com/apk/res/com.example.android.customviews"
to either
xmlns:custom="http://schemas.android.com/apk/lib/com.example.android.customviews"
or
xmlns:custom="http://schemas.android.com/apk/res-auto"
worked. There were some differences between them, and I found the second solution perfect for what I needed. I don't know why it works.
I meet the same problem,I think your custom attributes don't belong to the right namespace.You can get the demo of customview_panda and look at custom attribute in the main.xml,you will understand.
https://github.com/pandabo1985/Android_App_Prac

Categories

Resources