在一个片段上,我有像
这样的布局question.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="44dp"
android:layout_marginTop="47dp"
android:text="TextView" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/question"
android:layout_marginLeft="85dp"
android:layout_toRightOf="@+id/question"
android:text="CheckBox" />
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/question"
android:layout_marginTop="23dp"
android:ems="10"
android:inputType="text" />
</RelativeLayout>
我有这样的界面
但问题是,当我专注于EditText并尝试在其中编写内容时,则没有任何事情发生。没有文字,没有键盘显示。如果我单击并按住EditText,则会显示无需粘贴的消息。为什么文本没有输入编辑文本?
这是我的代码
public class ListFrag extends ListFragment {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setListAdapter(new ListFragAdapter(
new MyListData("Software Engineer", "Basit", "4 years"),
new MyListData("Lt. Commander", "Kashif", "12 years"),
new MyListData("Beautiful", "Hafsa", "23 years"),
new MyListData("Electrical Engineer", "Wajahat", "7 years"),
new MyListData("Doctor", "Mehreen", "12 years")));
} //end of onActivityCreated()
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
MyListData listData = (MyListData)getListAdapter().getItem(position);
DetailFrag frag = (DetailFrag) getFragmentManager().findFragmentById(R.id.frag_capt);
if (frag != null && frag.isInLayout()) {
getData(position, listData, frag);
}
} //end of onListItemClick()
private void getData(int position, MyListData listData, DetailFrag frag) {
String artist = listData.artist;
String title = listData.title;
frag.setText(artist, title);
} //end of getData()
} //end of class ListFrag
这是我的细节片段
public class DetailFrag extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.question , container, false);
return view;
} //end of onCreateView()
public void setText(String artist, String title) {
TextView leftSide_artist = (TextView) getView().findViewById(R.id.question);
leftSide_artist.setText(artist);
} //end of setText()
} //end of class DetailFrag
由于
答案 0 :(得分:0)
是的,有区别,通常它发生在Landscap模式键盘没有弹出AVD但在设备上工作正常,我是如何管理的
尝试它是否适合你
答案 1 :(得分:0)
另一种可能性是您在您的活动或 AndroidManifest.xml 中的应用程序中设置 hardwareAccelerated = false