Custom UI library not working in project - java

I have added a library in my project. However, when I use any of the views provided by the library, it gives me unbound prefix error. I have added the namespace as well in my xml file, still I am getting this error.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:wingokuFlatUI="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.wingoku.flatUI.WinGokuFlatButton
android:id="#+id/wingoku3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="wingoku"
android:textColor="#fff"
wingokuFlatUI:normalStateColor="#EB974E"
wingokuFlatUI:pressedStateColor="#F2784B" />
</RelativeLayout>
UPDATE:
After making some changes, now I am getting this error
Multiple annotations found at this line:
- error: No resource identifier found for attribute 'normalStateColor' in package
'com.example.android_flatui_testing'
- error: No resource identifier found for attribute 'pressedStateColor' in package
'com.example.android_flatui_testing'
What changes can I make to the code in order to get rid of this error?
Regards

The namespace you are defining is flatUI and you are using flatui later. I think you should be using the same character casing in both the instances.

I found this website for this before...
they implemented an example for adding the xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:wingokuFlatButton="http://schemas.android.com/apk/res/com.wingoku.flatUI"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

Related

Bottom Navigation Bar in Android Studio not Working?

bottomNavigationView.setOnNavigationItemSelectedListener{
when (it.itemId){
R.id.local1 -> make_Fragment(fragment1)
R.id.local2-> make_Fragment(fragment2)
R.id.local3 -> make_Fragment(fragment3)
}
true
}
Here bottomNavigationView is throwing error : Unresolved reference: bottomNavigationView and also i defined the id on mainactivity.xml
<?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"
tools:context=".main.MainActivity">
<FrameLayout
android:id="#+id/fl_wapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#id/bottomNavigationView"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:menu="#menu/bottom_nav"
/>
</RelativeLayout>
Here bottomNavigationView shows error and also when(it.itemId){
the bottomNavigationView is the id of the bottom bar.i also tried clean project and rebuild project.
tell me a solution to resolve this problem?
add these in build.gradle(:app)
id 'kotlin-android'
id 'kotlin-android-extensions'
this in dependencies
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10"
like this
dependencies {
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" }
add this import statement in MainActivity.kt
import kotlinx.android.synthetic.main.mainactivity.*
it will work just fine :)...
Add this dependencies in build.gradle
implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
implementation "androidx.navigation:navigation-ui-ktx:2.3.5"
Add kotlin code implementation
Please refer this my github repository for better understanding.
https://github.com/meshramaravind/BottomNavigtaionApp

Android include layout: pass Drawable parameter using data binding gives error: AAPT: error: attribute mysrc (aka com.example.APPNAME:mysrc) not found

I am trying to pass a Drawable as parameter into my include.
I have enabled dataBinding in my build.gradle file:
android {
dataBinding {
enabled = true
}
....
}
action_bar_button.xml:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable name="mysrc" type="android.graphics.drawable.Drawable"/>
</data>
<ImageButton android:id="#+id/notification"
android:background="#null"
android:foreground="?android:attr/actionBarItemBackground"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:padding="15dp"
android:src="#{mysrc}"
android:scaleType="fitCenter"></ImageButton>
</layout>
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity"
android:id="#+id/mainlayout">
<include layout="#layout/action_bar_button" app:mysrc="#{#drawable/notification}"/>
</RelativeLayout>
This keeps giving me error pointing to the include statement in my activity_main.xml:
AAPT: error: attribute mysrc (aka com.example.APPNAME:mysrc) not found.
If I change the app:mysrc in activity_main.xml to android:mysrc, it gives me error:
AAPT: error: attribute android:mysrc not found.
I have been stuck with this for few hours and have tried quite a few Stack Overflow posts but can't seem to resolve it.
Here, there must be a drawable variable in both the action_bar_button.xml and activity_main.xml layout files
I assume you should have this in your included layout:
<data>
<variable name="mysrc" type="android.graphics.drawable.Drawable"/>
</data>

R cannot be resolved to a variable (different scenario)

Firstly, I have searched and seen similar questions on Stackoverflow however I'm building outside Android studio or Eclipse so mine is a bit different and I'm looking for a solution or alternative if possible.
I am building a plugin that sends messages between Java and Javascript using Cordova.
I have 3 lines to resolve:
setContentView(R.layout.main);
mPreview = (CameraSourcePreview) findViewById(R.id.preview);
mGraphicOverlay = (GraphicOverlay) findViewById(R.id.faceOverlay);
Specifically just the setContentView(R.layout.main), findViewById(R.id.preview) and findViewById(R.id.faceOverlay). The layout file is in ../../../res/layout/main.xml and ../../../res/layout-land/main.xml.
All I want is a way to access, I do not have a R.java file and I'm not very experienced with Java unlike Javascript.
Is there a way to point to those files please, thanks.
main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/topLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true">
<com.cordovaplugincamerapreview
android:id="#+id/preview"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.cordovaplugincamerapreview
android:id="#+id/faceOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.cordovaplugincamerapreview>
</LinearLayout>

Android ScrollView not working

I have a layout which I want to be scrollable when content is overflowing the screen.
I have the following layout xml set up.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:id="#+id/ScrlView"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:isScrollContainer="false"
android:id="#+id/home_root"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/backrepeat">
<!-- Include Header -->
<include layout="#layout/main_header"/>
<!-- Include dashboard -->
<include layout="#layout/dashboard"/>
</LinearLayout>
</ScrollView>
A dashboard is a collection of icons serving as a menu. Example: click me
Unfortunately, the second include (dashboard) shows 'broken' now. See screen:
Click here
As you can see it doesn't look like it's suposed to. When I delete the scrollview, everything is fine.
What I want is for my dashboard to still look good, but be scrollable if needed.
I tried several setups but all give the same result. What am I doing wrong?
Any help would be appreciated :)
Remove the android:isScrollContainer="false", and add android:fillViewport="true" to scrollView

Generate R.Java and Layout - Intellij vs Eclipse

please look at this main.xml -
<TableLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/TableLayout03">
In eclipse its coming out fine, no errors and project is working
In Intellij its stopping my project from generating a R.java class file and if I undo the main.xml to the default, R.java is present and its marking red a host of resource reference.e.g R.layout.main, R.id.myWebSite
What am I doing wrong?
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
İ think you should remove id part.

Categories