Skip to content

Commit 6ec8283

Browse files
author
Ingo Schwarz
committed
Add documentation about how to use SimpleTableHeaderAdapter
1 parent c56088a commit 6ec8283

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,32 @@ This view is automatically shown if no data is available and hidden if there is
194194
#### Header Data
195195
Setting data to the header views is identical to setting data to the table cells. All you need to do is extending the `TableHeaderAdapter` which is also providing the easy access methods that are described for the `TableDataAdapter`.
196196
If all you want to display in the header is the column title as String (like in most cases) the `SimpleTableHeaderAdapter` will fulfil your needs.
197+
To show simple Strings inside your table header, use the following code:
198+
```
199+
public class MainActivity extends AppCompatActivity {
200+
201+
private static final String[] TABLE_HEADERS = { "This", "is", "a", "test" };
202+
203+
@Override
204+
protected void onCreate(Bundle savedInstanceState) {
205+
// ...
206+
tableView.setHeaderAdapter(new SimpleTableHeaderAdapter(this, TABLE_HEADERS));
207+
}
208+
}
209+
```
210+
To show Strings from resources inside your table header, use the following code:
211+
```
212+
public class MainActivity extends AppCompatActivity {
213+
214+
private static final int[] TABLE_HEADERS = { R.string.header_col1, R.string.header_col2, R.string.header_col3 };
215+
216+
@Override
217+
protected void onCreate(Bundle savedInstanceState) {
218+
// ...
219+
tableView.setHeaderAdapter(new SimpleTableHeaderAdapter(this, TABLE_HEADERS));
220+
}
221+
}
222+
```
197223

198224
### Interaction Listening
199225
#### Data Click Listening

0 commit comments

Comments
 (0)