0
我的Android項目出現問題。我在ScrollView中使用了EditText,但是我無法在其上輸入文字?在我將數據放入微調器之前,它運行正常。但是現在,即使我評論java代碼,它仍然不起作用。你可以幫我嗎?這是我的代碼。無法在edittext上輸入文字android
<LinearLayout
android:id="@+id/booking_guest_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="15dp"
android:background="@color/mau_trang">
<TextView
android:id="@+id/tv_booking_guest_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/booking_guest_info"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:textSize="18sp"
android:textColor="@color/caldroid_black"/>
<Spinner
android:id="@+id/booking_drop_qd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/border_gray">
</Spinner>
<EditText
android:id="@+id/tv_passengername"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/enter_passengername"
android:background="@drawable/border_gray"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:textSize="18sp"/>
<Spinner
android:id="@+id/booking_drop_baggages_tart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/border_gray">
</Spinner>
<Spinner
android:id="@+id/booking_drop_baggages_end"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="30dp"
android:background="@drawable/border_gray">
</Spinner>
</LinearLayout>
文件的.java
public class booking_form extends AppCompatActivity {
ArrayAdapter<CharSequence> adapter_qd, adapter_baggage_start, adapter_baggage_end;
Spinner sp_qd, sp_baggage_start,sp_baggage_end;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.booking_form_activity);
sp_qd = (Spinner) findViewById(R.id.booking_drop_qd);
sp_baggage_end = (Spinner) findViewById(R.id.booking_drop_baggages_end);
sp_baggage_start = (Spinner) findViewById(R.id.booking_drop_baggages_tart);
adapter_qd = ArrayAdapter.createFromResource(this, R.array.nguoi_lon, android.R.layout.simple_spinner_item);
adapter_baggage_start = ArrayAdapter.createFromResource(this, R.array.baggage_start, android.R.layout.simple_spinner_item);
adapter_baggage_end = ArrayAdapter.createFromResource(this, R.array.baggage_end, android.R.layout.simple_spinner_item);
//set các giá trị vào spinner
sp_qd.setAdapter(adapter_qd);
sp_baggage_start.setAdapter(adapter_baggage_start);
sp_baggage_end.setAdapter(adapter_baggage_end);
}
}
感謝您的支持!
我都試過,但它不工作:((( – kokorambo