在leanback library carousel中选择时,我试图使整行展开。
我想要的效果:
我正在处理 android TV 示例代码。我已经尝试setExpandedRowHeight(..);
过setRowHeight(..);
/**
* Created by sylversphere on 15-03-16.
*/
public class ExperimentalFragment extends BrowseFragment{
private ArrayObjectAdapter mRowsAdapter;
private ExperimentalCardPresenter mCardPresenter;
private int NUM_ROWS = 20;
private int NUM_COLS = 40;
private Context context;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
context = getActivity();
setTitle("Hello there you kid"); // Badge, when set, takes precedent
setHeadersState(HEADERS_DISABLED);
loadRows();
}
private void loadRows() {
List<Movie> list = MovieList.setupMovies();
final ListRowPresenter lrp = new ListRowPresenter(FocusHighlight.ZOOM_FACTOR_LARGE);
lrp.setRowHeight(100);
lrp.setExpandedRowHeight(200);
mRowsAdapter = new ArrayObjectAdapter(lrp);
mCardPresenter = new ExperimentalCardPresenter();
int i;
for (i = 0; i < NUM_ROWS; i++) {
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(mCardPresenter);
for (int j = 0; j < NUM_COLS; j++) {
listRowAdapter.add(list.get(j % 5));
}
mRowsAdapter.add(new ListRow(listRowAdapter));
}
setAdapter(mRowsAdapter);
}
private void say(String s) {
Toast.makeText(context, "Say : "+s, Toast.LENGTH_SHORT).show();
}
}
但行保持不变。我尝试手动为行设置动画,但现在行之间没有适当的填充。我将如何使行扩展并保持填充?