Android using custom view PullToRefreshSwipeListView - android

I am trying to use both PullToRefresh and SwipeListView libraries in listview using PullToRefreshSwipeListView custom view class. I have implemented it like that:
First I have imported PullToRefresh library into my project then I have added a SwipeListView Jar File into PullToRefresh library projet by making a libs folder in it. Then I have added PullToRefreshSwipeListView class in the src folder(com.handmark.pulltorefresh.library) of PullToRefresh library project. Finally I am trying to implement this custom class PullToRefreshSwipeListView into my project's xml as:
<com.handmark.pulltorefresh.library.PullToRefreshListView
xmlns:swipe="http://schemas.android.com/apk/res-auto"
xmlns:ptr="http://schemas.android.com/apk/res-auto"
android:id="#+id/lv_Inbox"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000"
android:divider="#19000000"
android:dividerHeight="2dp"
android:fadingEdge="none"
android:fastScrollEnabled="false"
android:footerDividersEnabled="false"
android:headerDividersEnabled="false"
android:scrollbars="none"
android:smoothScrollbar="true"
ptr:ptrAnimationStyle="flip" >
<libs.swipelistview.SwipeListView
android:id="#+id/users_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#0000"
android:clipToPadding="false"
android:divider="#null"
android:dividerHeight="0px"
android:fadingEdge="none"
android:scrollbarStyle="outsideOverlay"
swipe:swipeActionLeft="reveal" />
</com.handmark.pulltorefresh.library.PullToRefreshListView>
But I am getting error in xml as:
error: No resource identifier found for attribute 'swipeActionLeft' in package
error: No resource identifier found for attribute 'swipeActionLeft' in package
error: No resource identifier found for attribute 'swipeMode' in package
It does not get any of the swipe attribute but If I remove swipe attributes. It is working fine for only PullToRefresh. I am following this link to implement it. Any Solution/Comments will be most appreciated.

Why are you trying to merge PullToRefresh into SwipeListView library ? I have used PullToRefresh with SwipeListView without no problems (just imported using gradle not JARs).
You are getting these errors because you have not copied swipelistview__attrs.xml from res/values in SwipeListView library (this file)

better you go with
swiperefresh layout
https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html

Related

The following classes could not be found: android.support.constraint.RelativeLayout

I'm trying to change a ConstraintLayout to RelativeLayout in XML. Every time I do, I get the Missing Classes error:
The following classes could not be found: android.support.constraint.RelativeLayout
What am I missing?
RelativeLayout is not inside that package, you should use :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp" >
Or if you are importing inside your class:
import android.widget.RelativeLayout;

NestedScroll overlayTop AppBar error

Problem is that just I can't user overlayTop but I've got Support Design Library 23.1 included and every component usable just this one not
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/nes_scroll"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
app:behavior_overlayTop="44dp">
...
and here's error:
Error:(50) No resource identifier found for attribute behavior_overlayTop in package com.scroll.example
also it's not usable in Java source too, it's just red line and offers to create class related to setOverlapTop().

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 when Importing jazzylistview sample project

Hello I'm importing jazzylistview sample project and i get the following error in the layout file:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.twotoasters.jazzylistview.sample"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/background"
tools:context=".MainActivity" >
<com.twotoasters.jazzylistview
android:id="#id/android:list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#null"
app:effect="helix"
app:only_animate_new_items="false"
app:only_animate_fling="false"
app:max_velocity="0" />
</FrameLayout>
I get the following error on com.twotoasters.jazzylistview line:
Multiple annotations found at this line:
- error: No resource identifier found for attribute 'only_animate_fling' in package
'com.twotoasters.jazzylistview.sample'
- error: No resource identifier found for attribute 'max_velocity' in package 'com.twotoasters.jazzylistview.sample'
- error: No resource identifier found for attribute 'effect' in package 'com.twotoasters.jazzylistview.sample'
- error: No resource identifier found for attribute 'only_animate_new_items' in package
'com.twotoasters.jazzylistview.sample'
please help me what should i do?
xmlns:app="http://schemas.android.com/apk/res/com.twotoasters.jazzylistview.sample"
here instead of using /com.twotoasters.jazzylistview.sample use your package name.

How to get "?android:attr/actionBarSize" with Compatibility Library

I'm trying to use Fragments and ActionBar in a Android 2.2 project. There is some error when using "?android:attr/actionBarSize", how to get and set that value correctly?
Example:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/frags">
<fragment class="com.example.android.hcgallery.TitlesFragment"
android:id="#+id/frag_title"
android:visibility="gone"
android:layout_marginTop="?android:attr/actionBarSize"
android:layout_width="#dimen/titles_size"
android:layout_height="match_parent" />
<fragment class="com.example.android.hcgallery.ContentFragment"
android:id="#+id/frag_content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
Error: No resource found that matches the given name (at 'layout_marginTop' with value '?android:attr/actionBarSize').
You should just use:
android:layout_marginTop="?attr/actionBarSize"
See http://developer.android.com/training/basics/actionbar/overlaying.html
"...The one with the android: prefix is for versions of Android that
include the style in the platform and the one without the prefix is
for older versions that read the style from the Support Library..."
For me replacing
android:layout_marginTop="?android:attr/actionBarSize"
with
android:layout_marginTop="?attr/actionBarSize"
helped to launch app on Android 2.2 and Android 4.3 without any issues.
I think the problem is that actionbar comes with android 3.0 and you are using 2.2. But there is a way to skip this by a extension called "actionbarsherlock".

Categories

Resources