我想要在水平滚动查看图像和每个图像下面我想要一个文本视图。我想动态地。到现在为止,我已经有图像背景的按钮,我使用文本方法设置文本,它的工作原理。但是,我想要从图像中分别编辑文本,因为我想为文本显示不同的颜色。这是我的xml:图像和文本在水平滚动查看(动态)
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/ImagesHsw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
</LinearLayout>
</HorizontalScrollView>
更新:
vi= ((LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.actor,null);
Button b = (Button)findViewById(R.id.actorImage);
TextView text = (TextView)findViewById(R.id.actorName);
for (int i=0; i<actors; i++) {
b.setBackgroundResource(R.drawable.actor);
b.setLayoutParams(new ViewGroup.LayoutParams(160,150));
text.setText(i);
actorsScrollView.addView(vi);
}
ü可以用[HorizontalVariableListView]尝试将其添加(https://github.com/sephiroth74/HorizontalVariableListView) – kId 2014-09-29 16:53:25
我曾经想过水平ListView和我已经找到了这个帖子的http:/ /www.dev-smart.com/archives/34,但我有进口问题。 – user3607469 2014-09-29 20:07:22
您是否正确添加了库? – kId 2014-09-30 03:16:53