gpt4 book ai didi

java - Android,内部有多个 View 的滚动菜单 - 来自 XML 的 View

转载 作者:行者123 更新时间:2023-12-01 15:21:38 25 4
gpt4 key购买 nike

这里是 super 新手。在谷歌和这些论坛上搜索了 4 个小时,但没有看到这个问题。抱歉,如果是的话,但就像我说的,这里是 super 新手。

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

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

我为此获得了一个 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);
}



}

最佳答案

这不就是一个带有ArrayAdapter 的普通ListView 吗?就像本例中的那样:Custom ListView items and adapters

关于java - Android,内部有多个 View 的滚动菜单 - 来自 XML 的 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10828428/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com