Adding TextProgressBar in xml layout : "Error parsing xml" - android

I´m using this Tutorial http://weavora.com/blog/2012/02/23/android-progressbar-with-text/
to implement a progressbar with text into my app.
I encountered following Problem though:
in my xml file it says: "Error parsing xml: unbound prefix"
here is my xml file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.test2.ChattingActivity"
tools:ignore="MergeRootFrame" >
<View
android:id="#+id/Line1"
android:layout_width="fill_parent"
android:layout_height="1.0dp"
android:layout_alignParentTop="true"
android:background="#android:color/darker_gray" />
<com.example.test2.TextProgressBar
android:id="#+id/progressBarWithText"
style="#android:style/Widget.ProgressBar.Horizontal"
android:layout_width="wrap_parent"
android:layout_height="wrap_content"
android:max="100"
android:maxHeight="30dp"
android:minHeight="30dp"
android:progress="70"
android:progressDrawable="#drawable/progressbar"
components:textSize="18dp"
components:textColor="#android:color/black"
components:text="Loading 70%" />
<Button
android:id="#+id/buttonTopic"
style="#style/buttongreywhite"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:drawableLeft="#drawable/ic_action_labels"
android:onClick="openTopicFragment"
android:text="#string/topics" />
<Button
android:id="#+id/buttonLike"
style="#style/buttongreywhite"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:drawableLeft="#drawable/ic_action_good"
android:onClick="likeWhatYouSaid"
android:text="#string/like" />
<View
android:id="#+id/Line2"
android:layout_width="fill_parent"
android:layout_height="1.0dp"
android:layout_alignBottom="#+id/buttonTopic"
android:layout_alignParentLeft="true"
android:background="#android:color/darker_gray" />
</RelativeLayout>
the modified progressbar class is located in com.example.test2
it´s name is TextProgressBar
What am i missing here? There are no other errors in any of my xml files.
I didnt find any answers concering my problem so far. Thank you for your help.

Your components prefix is undefined for your TextProgressBar.
Based on the tutorial you linked you should have the following in your RelativeLayout
xmlns:components="http://schemas.android.com/apk/res/com.example.test2"

Related

updating design and support libs broke UI

currently we are using design and support libs 23.1.1 , when i updated to 25 there is a big gap in the layout and i can't figure out why
unfortunately i need more reputation to post links , all the links inside the file , sorry.
https://gist.github.com/xxqxpxx/a652a0c26a132913cd67faf21a670515
included files : build.gradle , layoutfile.xml , fragmentfile.xml , mainactivity ,activity1.
screenshot before :
screenshot after :
In your layout file change the root Linear layout height form match_parent to wrap_content
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mainLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/authors_and_publishers_simpleDraweeView_margin_left"
android:orientation="vertical">
<com.facebook.drawee.view.SimpleDraweeView
android:id="#+id/authors_and_publishers_simpleDraweeView"
android:layout_width="#dimen/author_publishers_simpledraweeview"
android:layout_height="#dimen/author_publishers_simpledraweeview"
android:layout_gravity="center_horizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/authors_publishers_name_layout_margin_top"
android:orientation="vertical">
<com.kotobi.widget.fonts.views.textviews.RobotoLight
android:id="#+id/authorName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:lines="1"
android:text="Name"
android:textSize="#dimen/author_publisher_pop_up_followrs_text_size" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/authors_and_publishers_simpleDraweeView_margin_top">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="#dimen/author_publisher_pop_up_image_dimen"
android:layout_height="#dimen/author_publisher_pop_up_image_dimen"
android:layout_gravity="center_vertical"
android:layout_marginRight="#dimen/author_publisher_pop_up_image_dimen_margin_right"
android:background="#drawable/followers" />
<com.kotobi.widget.fonts.views.textviews.RobotoLight
android:id="#+id/numberOfFollowers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="12"
android:textColor="#color/grey"
android:textSize="#dimen/author_publisher_pop_up_followrs_number_books" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true">
<ImageView
android:layout_width="#dimen/author_publisher_pop_up_image_dimen"
android:layout_height="#dimen/author_publisher_pop_up_image_dimen"
android:layout_gravity="center_vertical"
android:layout_marginRight="#dimen/author_publisher_pop_up_image_dimen_margin_right"
android:background="#drawable/number_books" />
<com.kotobi.widget.fonts.views.textviews.RobotoLight
android:id="#+id/numberOfBooks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="12"
android:textColor="#color/grey"
android:textSize="#dimen/author_publisher_pop_up_followrs_number_books" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>

class file for android.support.v4.widget.TintableCompoundButton not found

I want to Create a CheckBox, My compile
sdk version is 23,
Target version is 23,
build tool version is 23.0.0,
in gradle I'hv added
compile 'com.android.support:support-v4:23.2.0',
compile 'com.android.support:appcompat-v7:23.2.0'
both and in menifest given the app theme as android:theme="#style/Theme.AppCompat.Light.NoActionBar" and no specific theme to Activity. when I run my code its throwing
InflateException line number #23 at xml file, problem while inflating kind of
Then I decided to convery a simple ChcekBox to android.support.v7.widget.AppCompatCheckBox but on the xml file Preview its showing Rendering Problems The following classes could not be instantiated:
- android.support.v7.widget.AppCompatCheckBox
Exception Details java.lang.ClassNotFoundException: android.support.v4.widget.TintableCompoundButton
and if i try to run it it gives me class file for android.support.v4.widget.TintableCompoundButton not found.
So, Any one faced this issue?
<?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:background="#color/white"
android:orientation="vertical">
<LinearLayout
android:id="#+id/lnv_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rlv_header"
android:orientation="vertical">
<android.support.v7.widget.AppCompatCheckBox
android:id="#+id/confirmCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:checked="false"
android:gravity="start"
android:text="#string/personal_confirm_text"
android:textColor="#color/black"
android:textSize="14sp" />
</LinearLayout>
<RelativeLayout
android:id="#+id/rlv_next"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="40dp"
android:background="#color/crabfx_light_gray"
android:visibility="gone">
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_alignParentTop="true"
android:background="#color/crabfx_green" />
<TextView
android:id="#+id/tv_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:drawablePadding="10dp"
android:drawableRight="#drawable/discloser"
android:gravity="center_vertical"
android:text="#string/lbl_next"
android:textColor="#color/black"
android:textSize="18sp" />
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="#color/crabfx_green" />
</RelativeLayout>
</RelativeLayout>
and below is the theme to Application tag in menifest
android:theme="#style/Theme.AppCompat.Light.NoActionBar"

No resource found that matches the given name for Layout_to_left_of

why the layout_toLeftOf attribute could not find the resource. I did have that id in the layout, and why this happens. I am using Intellij IDEA, even I tried to rebuild the code, the error still exists. Any advice, thanks in advance.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="#dimen/list_item_entry_container_height"
android:padding="#dimen/list_item_entry_container_padding">
<ImageView
android:id="#+id/list_item_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"/>
<ImageView
android:id="#+id/list_item_space"
android:layout_width="#dimen/list_item_entry_space_width"
android:layout_height="fill_parent"
android:layout_toRightOf="#id/list_item_icon"/>
<TextView
android:id="#+id/list_item_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:singleLine="true"
android:textColor="#color/list_item_entry_title_text_color"
android:textSize="#dimen/list_item_entry_title_text_size"
android:layout_toRightOf="#id/list_item_space"
android:layout_toLeftOf="#id/list_item_action"/>
<RelativeLayout
android:id="#+id/list_item_subtitle_group"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/list_item_title"
android:layout_below="#id/list_item_title"
android:layout_toLeftOf="#id/list_item_action"
android:layout_toRightOf="#id/list_item_space">
<ImageView
android:id="#+id/list_item_download_status_icon"
android:layout_width="#dimen/list_item_entry_download_icon_width"
android:layout_height="#dimen/list_item_entry_download_icon_height"
android:visibility="gone"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:contentDescription="#null"
android:layout_marginLeft="#dimen/list_item_entry_download_icon_margin_left"
android:layout_marginTop="#dimen/list_item_entry_download_icon_margin_top"
android:src="#drawable/list_item_download_ok"/>
<ProgressBar
android:id="#+id/list_item_download_status_progressbar"
android:layout_width="#dimen/list_item_entry_download_progressbar_width"
android:layout_height="#dimen/list_item_entry_download_progressbar_height"
android:layout_alignParentLeft="true"
android:layout_marginLeft="#dimen/list_item_entry_download_progressbar_margin_left"
android:layout_marginTop="#dimen/list_item_entry_download_progressbar_margin_top"
android:layout_toRightOf="#id/list_item_download_status_icon"
android:visibility="gone"/>
<TextView
android:id="#+id/list_item_subtitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/list_item_download_status_progressbar"
android:textColor="#color/list_item_entry_subtitle_text_color"
android:textSize="#dimen/list_item_entry_subtitle_text_size"/>
</RelativeLayout>
<ImageView
android:id="#+id/list_item_action"
android:layout_width="#dimen/list_item_entry_action_width"
android:layout_height="fill_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
The reason is that list_item_action is defined after it is used. It is defined in the last. It is used before.
As suggested by amit singh - use: #+id => This will define if it is not defined already.
Alternatively, move the definition of list_item_action before you use it.
Replace this line-
android:layout_toLeftOf="#id/list_item_action"
with this line-
android:layout_toLeftOf="#+id/list_item_action"

got error like error: Error: No resource found that matches the given name (at 'id' with value '#id/ surface_view')

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="74.0dip"
xmlns:android="http://schemas.android.com/apk/res/android">
<io.vov.vitamio.widget.CenterLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
<io.vov.vitamio.widget.VideoView android:id="#id/surface_view" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_centerHorizontal="true" android:layout_centerVertical="true" />
</io.vov.vitamio.widget.CenterLayout>
</RelativeLayout>
mediaconroller.xml
<RelativeLayout android:orientation="horizontal" android:background="#drawable/mediacontroller_bg" android:layout_width="fill_parent" android:layout_height="74.0dip" android:layout_marginLeft="0.0dip" android:layout_marginRight="0.0dip" android:layout_marginBottom="0.0dip" android:layout_alignParentBottom="true"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageButton android:gravity="center" android:id="#id/mediacontroller_play_pause" android:background="#00000000" android:layout_width="54.599976dip" android:layout_height="32.0dip" android:layout_marginRight="7.0dip" android:src="#drawable/mediacontroller_pause_button" android:layout_alignParentRight="true" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:contentDescription="#string/mediacontroller_play_pause" />
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="7.0dip" android:layout_marginTop="2.0dip" android:layout_marginRight="7.0dip" android:layout_marginBottom="2.0dip" android:layout_toLeftOf="#id/mediacontroller_play_pause">
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:id="#id/mediacontroller_time_current" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" style="#style/MediaController_Text" />
<TextView android:id="#id/mediacontroller_time_total" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true" style="#style/MediaController_Text" />
</RelativeLayout>
<SeekBar android:id="#id/mediacontroller_seekbar" android:focusable="true" android:layout_width="fill_parent" android:layout_height="wrap_content" android:max="1000" android:layout_centerVertical="true" style="#style/MediaController_SeekBar" />
<TextView android:ellipsize="marquee" android:id="#id/mediacontroller_file_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:layout_alignParentBottom="true" style="#style/MediaController_Text" />
</RelativeLayout>
</RelativeLayout>
I have four files in res/drawable folder which have following names
mediacontroller_pause_button.xml
mediacontroller_play_button.xml
mediacontroller_seekbar_thumb.xml
mediacontroller_seekbar.xml
id is not updated automatically how can i update id ?
i am new to android please help me to solve this error i got error in following two layout file mediacontroller.xml and activity_main.xml
and error is
error: Error: No resource found that matches the given name (at 'id' with value '#id/ mediacontroller_time_current').
i am not using +id sign but the the thing is R.java is not automatically update it's id thats why i am not getting suggestion my question is how to get suggestion so my error is solved
You probably wanted to use android:id="#+id/surface_view" instead.
Basically, the "plus sign" indicates that you're defining a new id inline. If you don't add it, then you are instead adding a reference to an id, which must be preexisting.
For example, in android:layout_toLeftOf="#id/mediacontroller_play_pause" it's correct to omit the "+", because you're not defining that id in there.

What happen to my main.xml: error parsing xml unbound prefix error

I face an error in my main.xml. It display the error: "error parsing xml unbound prefix" at
My code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#drawable/white"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<com.facebook.android.LoginButton
android:id="#+id/login"
android:src="#drawable/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"/>
Error here-->
/>
<Button android:id="#+id/infoButton"
android:text="#string/information"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/txt"
android:layout_alignRight="#+id/txt"
/>
<Button android:id="#+id/postButton"
android:text="#string/post"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/txt"
android:layout_alignLeft="#+id/txt"
/>
<Button android:id="#+id/friendButton"
android:text="#string/friend"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/postButton"
android:layout_alignLeft="#+id/postButton"
/>
<ListView
android:id="#+id/friendsview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textFilterEnabled="true"
android:layout_below="#+id/friendButton"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>
and in my java files, it display error at the everything relating to R. For example: R.layout.main
Could you please help me? Thank you so much.
I believe the xmnls attribute should be the first attribute you declare in your RelativeLayout, otherwise it doesn't know what to do with the android: prefixes.
For your first question i.e. "error parsing xml unbound prefix", it could be coming because of the Facebook Login Widget. Try adding Facebook namespace to the RelativeLayout definition. Something like below:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#drawable/white"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:facebook="http://schemas.android.com/apk/res-auto">
For errors related to "R", trying putting an extra import in your activity class
import package.where.activity.is.present.R;
Hope this helps!

Categories

Resources