Java Android,内部有多个视图的滚动菜单-来自XML的视图

Java Android,内部有多个视图的滚动菜单-来自XML的视图,java,android,layout-inflater,Java,Android,Layout Inflater,这里是超级新手。已经在谷歌和这些论坛上搜索了4个小时,没有看到这个地址。如果是的话很抱歉,但就像我说的,这里是超级新手 我需要一个滚动视图,其中有一个线性布局。在线性布局中,我需要在其中定制“迷你布局”。这些是动态拉入的 其思想是用户登录,我们返回一个包含其内容的数据流。迷你布局将由图像、上下文本和按钮组成 我为此获得了一个xml,但当我查看数据列表时,它不会让我多次附加该xml。请帮帮我,如果我这样做是最糟糕的,请告诉我 谢谢 @Override public void onCreate(Bu

这里是超级新手。已经在谷歌和这些论坛上搜索了4个小时,没有看到这个地址。如果是的话很抱歉,但就像我说的,这里是超级新手

我需要一个滚动视图,其中有一个线性布局。在线性布局中,我需要在其中定制“迷你布局”。这些是动态拉入的

其思想是用户登录,我们返回一个包含其内容的数据流。迷你布局将由图像、上下文本和按钮组成

我为此获得了一个xml,但当我查看数据列表时,它不会让我多次附加该xml。请帮帮我,如果我这样做是最糟糕的,请告诉我

谢谢

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.springboard_view);

    // Set page title
    TextView temp = (TextView) findViewById(R.id.page_label);
    temp.setText("Springboard");

    // Get the message from the intent, format and set
    // We also need to keep the pdf's for the library page
    Intent intent = getIntent();
    String message = intent.getStringExtra(ffacademyActivity.EXTRA_MESSAGE);
    List<String[]> formattedStrings = formatStrings(message);
    List<String[]> pdfStrings = new ArrayList<String[]>();

    String[] almostThere;


    mInflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout convertView = (LinearLayout)mInflater.inflate(R.layout.sb_icon,null);



    while(!formattedStrings.isEmpty()) {
        setContentView(R.layout.sb_icon);
        almostThere = formattedStrings.remove(0);   

        if (almostThere[0].contains("product")) {
            TextView tempText = (TextView) findViewById(R.id.spring_board_title);
            tempText.setText(almostThere[2]);
            tempText = (TextView)findViewById(R.id.spring_board_description);
            tempText.setText(almostThere[5]);
        } else if (almostThere[0].contains("link")) {
            TextView tempText = (TextView) findViewById(R.id.spring_board_title);
            tempText.setText(almostThere[1]);
            tempText = (TextView)findViewById(R.id.spring_board_description);
            tempText.setText(almostThere[4]);
        } else {
            pdfStrings.add(almostThere);
        }

        setContentView(R.layout.springboard_view);
        LinearLayout linearLayout = (LinearLayout)findViewById(R.id.sbpad);
        linearLayout.addView(convertView);
    }



}
@覆盖
创建时的公共void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.springboard_视图);
//设置页面标题
TextView temp=(TextView)findViewById(R.id.page_标签);
临时设置文本(“跳板”);
//从意图、格式和设置中获取消息
//我们还需要保留图书馆页面的pdf
Intent=getIntent();
String message=intent.getStringExtra(ffacademyActivity.EXTRA_message);
List formattedStrings=formattstrings(消息);
List pdfStrings=new ArrayList();
字符串[]几乎在那里;
mInflater=(LayoutInflater)getApplicationContext().getSystemService(Context.LAYOUT\u INFLATER\u SERVICE);
LinearLayout convertView=(LinearLayout)最小充气(R.layout.sb_图标,空);
而(!formattedStrings.isEmpty()){
setContentView(R.layout.sb_图标);
almostThere=formattedStrings.remove(0);
if(几乎在那里[0]。包含(“产品”)){
TextView testext=(TextView)findViewById(R.id.spring\u board\u title);
testext.setText(几乎在那里[2]);
testext=(TextView)findViewById(R.id.spring\u board\u description);
testext.setText(几乎在那里[5]);
}else if(几乎在那里[0]。包含(“链接”)){
TextView testext=(TextView)findViewById(R.id.spring\u board\u title);
testext.setText(几乎在那里[1]);
testext=(TextView)findViewById(R.id.spring\u board\u description);
testext.setText(几乎在那里[4]);
}否则{
pdfStrings.add(几乎在那里);
}
setContentView(R.layout.springboard_视图);
LinearLayout LinearLayout=(LinearLayout)findViewById(R.id.sbpad);
linearLayout.addView(convertView);
}
}

这不只是一个带有ArrayAdapter的普通ListView吗。就像这个例子中的例子:

是的,是的。就像我说的,超级新手问题。在发布这篇文章之后,我发现了一些关于适配器的信息,但是谢谢你的正确答案!