0

我想将 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>
4

1 回答 1

0

我觉得我问的问题有点不对。

但我发现,由于我有一个输入字段,系统总是希望专注于一个输入。所以我在Android Manifest 中将windowSoftInputMode 设置为stateHidden。

知道活动开始时键盘不会自动打开。

于 2013-02-06T12:23:55.917 回答