可自定义的按钮,这是正确的还是有更好的选择?
Posted
技术标签:
【中文标题】可自定义的按钮,这是正确的还是有更好的选择?【英文标题】:customizable buttons, It is correct or is there a better option? 【发布时间】:2016-06-19 15:17:17 【问题描述】:我想自定义按钮,以显示“title0,TITLE1”等。我想放一些我自己的东西,LocalVideo,listvideo ..等。 我发现它的唯一解决方案。但我认为这是不正确的。 肯定是不同的东西。
代码库:
/* CardPresenter */
HeaderItem cardPresenterHeader = new HeaderItem(1, "CardPresenter");
CardPresenter cardPresenter = new CardPresenter();
ArrayObjectAdapter cardRowAdapter = new ArrayObjectAdapter(cardPresenter);
for(int i=0; i<3; i++)
Movie movie = new Movie();
if(i%3 == 0)
movie.setCardImageUrl("http://heimkehrend.raindrop.jp/kl-hacker/wp-content/uploads/2014/08/DSC02580.jpg");
else if (i%3 == 1)
movie.setCardImageUrl("http://heimkehrend.raindrop.jp/kl-hacker/wp-content/uploads/2014/08/DSC02630.jpg");
else
movie.setCardImageUrl("http://heimkehrend.raindrop.jp/kl-hacker/wp-content/uploads/2014/08/DSC02529.jpg");
movie.setTitle("title" + i);
movie.setStudio("studio" + i);
cardRowAdapter.add(movie);
mRowsAdapter.add(new ListRow(cardPresenterHeader, cardRowAdapter));
代码已更改:
/* CardPresenter */
HeaderItem cardPresenterHeader = new HeaderItem(1, "CardPresenter");
CardPresenter cardPresenter = new CardPresenter();
ArrayObjectAdapter cardRowAdapter = new ArrayObjectAdapter(cardPresenter);
for(int i=0; i<1; i++)
Movie movie = new Movie();
if(i%3 == 0)
movie.setCardImageUrl("http://heimkehrend.raindrop.jp/kl-hacker/wp-content/uploads/2014/08/DSC02580.jpg");
movie.setTitle("Videoview");
movie.setStudio("Video local video");
cardRowAdapter.add(movie);
for(int i=0; i<1; i++)
Movie movie = new Movie();
if(i%3 == 0)
movie.setCardImageUrl("http://heimkehrend.raindrop.jp/kl-hacker/wp-content/uploads/2014/08/DSC02580.jpg");
movie.setTitle("Listview");
movie.setStudio("Listview local video");
cardRowAdapter.add(movie);
mRowsAdapter.add(new ListRow(cardPresenterHeader, cardRowAdapter));
【问题讨论】:
【参考方案1】:如果你指的是this site,请问我。
这是你想要的吗?
/* CardPresenter */
HeaderItem cardPresenterHeader = new HeaderItem(1, "CardPresenter");
CardPresenter cardPresenter = new CardPresenter();
ArrayObjectAdapter cardRowAdapter = new ArrayObjectAdapter(cardPresenter);
// Create movie1 object
Movie movie1 = new Movie();
movie1.setCardImageUrl("http://heimkehrend.raindrop.jp/kl-hacker/wp-content/uploads/2014/08/DSC02580.jpg");
movie1.setTitle("Videoview");
movie1.setStudio("Video local video");
// Create movie2 object
Movie movie2 = new Movie();
movie2.setCardImageUrl("http://heimkehrend.raindrop.jp/kl-hacker/wp-content/uploads/2014/08/DSC02580.jpg");
movie2.setTitle("Listview");
movie2.setStudio("Listview local video");
// put movie1 and movie2 into cardRowAdapter
cardRowAdapter.add(movie1);
cardRowAdapter.add(movie2);
// show cardRowAdapter in listrow
mRowsAdapter.add(new ListRow(cardPresenterHeader, cardRowAdapter));
【讨论】:
以上是关于可自定义的按钮,这是正确的还是有更好的选择?的主要内容,如果未能解决你的问题,请参考以下文章