Comments (10)
I really don't understand your problem. All the magic's inside getItemViewType
. Reimplement it.
from tablefixheaders.
I figured it out, but thanks for the heads up.
from tablefixheaders.
Hi cchong, I am on same issue can you please elaborate the solution using getItemViewType
from tablefixheaders.
Hi Jayesh please take a look at this link to give you an idea of what worked for me. You may need to change it to suit your needs.
from tablefixheaders.
Thank you Christopher, I have one more question, How we handle touch listener on each list item of the table row? I want to change the color and text of (right movable panel).
I have applied onclicklistener to convert view but it is not working properly. hope you got my question.
thanks!
from tablefixheaders.
Hi Jayesh, unfortunately it has been a while since I've used the TableFixHeaders library so I am unable to help you with your specific question. But I imagine you need to play around with the properties to achieve what you're looking for.
from tablefixheaders.
Hi guys, i need add item onclick in this library. How to make item onclick in tablefixheader.
Thanks !
from tablefixheaders.
Please, no ask things in an issue with a diferent topic. Anyway, before you return a view in you adapter you can set an OnClickListener on the view. Something like: converView.setOnClickListener(listener);
from tablefixheaders.
I tried to use the way on this link .but, the application stopped with logchat
java.lang.IndexOutOfBoundsException: Index: 10, Size: 10
at java.util.ArrayList.get(ArrayList.java:411)
at app.al.ti.tianappv3.Dashboard.Feagment.FragmentNilai$NexusTypes.get(FragmentNilai.java:201)
I tried to compare my code and i do not find where my mistake, Maybe some one can help me.,.,?
from tablefixheaders.
please use this code without family row
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.royalways.gnauniversity.R;
import java.util.ArrayList;
import java.util.List;
public class TimeTableAdapter extends BaseTableAdapter {
private class NexusTypes {
private final List<Nexus> list;
NexusTypes() {
list = new ArrayList<Nexus>();
}
private int size() {
return list.size();
}
private Nexus get(int i) {
return list.get(i);
}
}
private class Nexus {
private final String[] data;
private Nexus(String name, String company, String version, String api, String storage, String inches, String ram) {
data = new String[]{
name,
company,
version,
api,
storage,
inches,
ram};
}
}
private Context context;
private final NexusTypes familys;
private final String headers[] = {
"Name",
"Company",
"Version",
"API",
"Storage",
"Size",
"RAM",
};
private final int[] widths = {
120,
100,
140,
60,
70,
60,
60,
};
private final float density;
public TimeTableAdapter(Context context) {
this.context = context;
familys = new NexusTypes();
density = context.getResources().getDisplayMetrics().density;
familys.list.add(new Nexus("Nexus One", "HTC", "Gingerbread", "10", "512 MB", "3.7\"", "512 MB"));
familys.list.add(new Nexus("Nexus S", "Samsung", "Gingerbread", "10", "16 GB", "4\"", "512 MB"));
familys.list.add(new Nexus("Galaxy Nexus (16 GB)", "Samsung", "Ice cream Sandwich", "15", "16 GB", "4.65\"", "1 GB"));
familys.list.add(new Nexus("Galaxy Nexus (32 GB)", "Samsung", "Ice cream Sandwich", "15", "32 GB", "4.65\"", "1 GB"));
familys.list.add(new Nexus("Nexus 4 (8 GB)", "LG", "Jelly Bean", "17", "8 GB", "4.7\"", "2 GB"));
familys.list.add(new Nexus("Nexus 4 (16 GB)", "LG", "Jelly Bean", "17", "16 GB", "4.7\"", "2 GB"));
familys.list.add(new Nexus("Nexus 7 (16 GB)", "Asus", "Jelly Bean", "16", "16 GB", "7\"", "1 GB"));
familys.list.add(new Nexus("Nexus 7 (32 GB)", "Asus", "Jelly Bean", "16", "32 GB", "7\"", "1 GB"));
familys.list.add(new Nexus("Nexus 10 (16 GB)", "Samsung", "Jelly Bean", "17", "16 GB", "10\"", "2 GB"));
familys.list.add(new Nexus("Nexus 10 (32 GB)", "Samsung", "Jelly Bean", "17", "32 GB", "10\"", "2 GB"));
familys.list.add(new Nexus("Nexus Q", "--", "Honeycomb", "13", "--", "--", "--"));
}
@Override
public int getRowCount() {
return familys.size();
}
@Override
public int getColumnCount() {
return 6;
}
@Override
public View getView(int row, int column, View convertView, ViewGroup parent) {
final View view;
switch (getItemViewType(row, column)) {
case 0:
view = getFirstHeader(row, column, convertView, parent);
break;
case 1:
view = getHeader(row, column, convertView, parent);
break;
case 2:
view = getFirstBody(row, column, convertView, parent);
break;
case 3:
view = getBody(row, column, convertView, parent);
break;
default:
throw new RuntimeException("wtf?");
}
return view;
}
private View getFirstHeader(int row, int column, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(context);
convertView = inflater.inflate(R.layout.item_table_header_first, parent, false);
}
((TextView) convertView.findViewById(android.R.id.text1)).setText(headers[0]);
return convertView;
}
private View getHeader(int row, int column, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(context);
convertView = inflater.inflate(R.layout.item_table_header, parent, false);
}
((TextView) convertView.findViewById(android.R.id.text1)).setText(headers[column + 1]);
return convertView;
}
private View getFirstBody(int row, int column, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(context);
convertView = inflater.inflate(R.layout.item_table_first, parent, false);
}
convertView.setBackgroundResource(row % 2 == 0 ? R.drawable.bg_table_color1 : R.drawable.bg_table_color2);
((TextView) convertView.findViewById(android.R.id.text1)).setText(getDevice(row).data[column + 1]);
return convertView;
}
private View getBody(int row, int column, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(context);
convertView = inflater.inflate(R.layout.item_table, parent, false);
}
convertView.setBackgroundResource(row % 2 == 0 ? R.drawable.bg_table_color1 : R.drawable.bg_table_color2);
((TextView) convertView.findViewById(android.R.id.text1)).setText(getDevice(row).data[column + 1]);
return convertView;
}
@Override
public int getWidth(int column) {
return Math.round(widths[column + 1] * density);
}
@Override
public int getHeight(int row) {
final int height;
if (row == -1) {
height = 35;
} else {
height = 45;
}
return Math.round(height * density);
}
@Override
public int getItemViewType(int row, int column) {
final int itemViewType;
if (row == -1 && column == -1) {
itemViewType = 0;
} else if (row == -1) {
itemViewType = 1;
} else if (column == -1) {
itemViewType = 2;
} else {
itemViewType = 3;
}
return itemViewType;
}
private Nexus getDevice(int row) {
return familys.get(row);
}
@Override
public int getViewTypeCount() {
return 5;
}
}
i just see your problem, I hope it will help you
from tablefixheaders.
Related Issues (20)
- How can i use it in a CoordinatorLayout HOT 1
- How can scroll in viewpage when columns stop scrolling HOT 4
- how to remove first column on fix hader HOT 2
- can i set header on image
- java.lang.NullPointerException: at com.inqbarna.tablefixheaders.TableFixHeaders.scrollBounds (TableFixHeaders.java:630) HOT 2
- Want to inflate more than one values in one column
- Issue with UI Thread block HOT 1
- search value in TableFixHeaders
- How to pass model array list to MatrixTableAdapter HOT 6
- How to insert data from api HOT 1
- Scroll issue when i put TableFixHeaders view inside a ScrollView/NestedScrollView HOT 2
- Text Color
- Not running in Tablet HOT 4
- Invalid content set in cell(view) during scrolling up,down or right, left...
- How to adapt the row height by context?
- How to set section header is aligned center on table? HOT 2
- Why does the table get inside the screen? HOT 5
- Android 9.0 landscape will crash
- after horizontal scrolling content get reset HOT 1
- Unable to use the lib
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 tablefixheaders.