我想将 ListView 添加到 LinearLayout。但是当应用程序启动时,它需要焦点并打开键盘。我不希望它那样做。
我已经尝试过 XML 和 Java 代码:
contentLayout = (LinearLayout)findViewById(R.id.contentView);
contentList = new ListView(this);
contentList.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
contentLayout.addView(contentList);
XML
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>