当我点击它所关注的edittext
时,我无法输入任何内容。我已经尝试将XML edittext
代码复制到另一个活动中并且工作正常,这表明它与java有关;但我不知道是什么。
代码:
ap_overview_add.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/ap_overview_add_LL"
android:background="@drawable/ap_button_background"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add amount"
android:textSize="30sp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="15dp">
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="@+id/ap_et_add"
android:background="@drawable/edit_text_background"
android:inputType="numberDecimal"
android:padding="10dp"
android:drawableLeft="@drawable/pound_24dp"
android:backgroundTint="@color/abc_secondary_text_material_light"
android:imeOptions="actionSend"
android:lines="1"
android:maxLines="1"
android:singleLine="true"
android:layout_weight=".75"/>
<Button
android:layout_width="wrap_content"
android:layout_height="40dp"
android:id="@+id/ap_button_add"
android:text="Add"
/>
</LinearLayout>
</LinearLayout>
我在一个BaseAdapter中,在getView方法中将其膨胀,如下所示:
public Integer[] mButtonIds = {
R.id.ap_overview_tab_LL,
R.id.ap_overview_add_LL,
R.id.ap_overview_rem_LL
};
public Integer[] mLayoutIds = {
R.layout.ap_overview_tab,
R.layout.ap_overview_add,
R.layout.ap_overview_rem
};
LinearLayout b;
View rootView;
LayoutInflater inflater;
inflater = LayoutInflater.from(mContext);
rootView = inflater.inflate(mLayoutIds[index], null);
b = (LinearLayout) rootView.findViewById(mButtonIds[index]);
return b;
在主要的活动课中我有:
GalleryImageAdapter galleryImageAdapter;
galleryImageAdapter = new GalleryImageAdapter(this);
// Initializing the custom gallery //
gallery.setAdapter(galleryImageAdapter);