Comments (13)
I fixed this bug, try the latest version. Let me know if it works and I'll make a new release.
compile 'com.github.mancj:MaterialSearchBar:0.6.1-beta'
from materialsearchbar.
The problem was that the maxSuggestionsCount
default value in the SuggestionsAdapter
is equals 0
. And you just had to set the new value manually
from materialsearchbar.
Its not working. See the below method. I have used the setMaxSuggestionCount. Should I do something else.
private void openSearchArea(List suggestions){
searchBar.setMaxSuggestionCount(suggestions.size());
customSuggestionsAdapter.setSuggestions(suggestions);
customSuggestionsAdapter.notifyDataSetChanged();
}
from materialsearchbar.
sorry, I made a mistake. You need to compile the version 0.6.1-beta. I updated my comment above
from materialsearchbar.
customSuggestionsAdapter.setMaxSuggestionsCount(suggestions.size());
customSuggestionsAdapter.setSuggestions(suggestions);
customSuggestionsAdapter.notifyDataSetChanged();
still doesn't work
from materialsearchbar.
Post your custom adapter code, please.
from materialsearchbar.
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mancj.materialsearchbar.adapter.SuggestionsAdapter;
public class CustomSuggestionsAdapter extends SuggestionsAdapter<String, CustomSuggestionsAdapter.SuggestionHolder> {
private SuggestionsAdapter.OnItemViewClickListener listener;
private String mUnderline = Constants.WHITE;
public CustomSuggestionsAdapter(LayoutInflater inflater) {
super(inflater);
}
public void setListener(SuggestionsAdapter.OnItemViewClickListener listener) {
this.listener = listener;
}
public void setUnderlineColor(String mColor){
mUnderline = mColor;
}
@Override
public void onBindSuggestionHolder(String suggestion, SuggestionHolder holder, int position) {
holder.title.setText(suggestion);
if(mUnderline == Constants.WHITE){
holder.view.setBackgroundColor(Color.WHITE);
}else{
holder.view.setBackgroundColor(Color.WHITE);
}
}
@Override
public SuggestionHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = getLayoutInflater().inflate(R.layout.suggestion_row, parent, false);
return new SuggestionHolder(view);
}
@Override
public int getSingleViewHeight() {
return 60;
}
class SuggestionHolder extends RecyclerView.ViewHolder{
protected TextView title;
protected View view;
public SuggestionHolder(View itemView) {
super(itemView);
title = (TextView) itemView.findViewById(R.id.my_list_item);
itemView.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
listener.OnItemClickListener(getAdapterPosition(),v);
}
} );
view = (View) itemView.findViewById(R.id.view);
}
}
}
from materialsearchbar.
I don't see any problems. Can you show the xml file?
And make sure MaterialSearchBar's height set to wrap_content.
from materialsearchbar.
from materialsearchbar.
I meant the xml file where you create MaterialSearchBar, not the adapter's row.
from materialsearchbar.
from materialsearchbar.
It still doesn't work with height wrap_content
?
from materialsearchbar.
Nop. It doesn't work. Leave this issue open. I will check your code after 10th. Thanks for the help.
from materialsearchbar.
Related Issues (20)
- how can scroll suggestion list when it more than 10 item ?
- No field mCursorDrawableRes in class Landroid/widget/TextView HOT 8
- Search icon or return key will open google app HOT 4
- Nav Icon Change?
- Library issue HOT 3
- Missing image resource in the lib
- Any way to give corner radius to the Search Bar HOT 1
- SearchBar not showing HOT 1
- .
- onButtonClicked Never Called
- Solving on Menu Item click
- Failed in build
- Setting CustomSuggestionAdapter HOT 1
- Suggestion Text Color HOT 2
- Last item is cut off HOT 1
- Font Family
- Incompatible with Gradle 8.0
- Cannot be cast to java.lang.String with custom suggestions adapter HOT 1
- Could not find com.github.mancj:MaterialSearchBar:0.8.5. HOT 1
- Use with listmap
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from materialsearchbar.