Autocompletetextview

时间:2013-04-11 12:07:24

标签: android

我使用简单代码显示自动完成textview,但为什么文本透明的textview以及下拉列表。我没有理由。请检查并告诉我原因。

java代码

public class SendEmailScreenActivity extends Activity{

 /** Called when the activity is first created. */
AutoCompleteTextView autoText;



String president[]=  {"manmohan","Bush","clinton","arafat","vajpayee","brown","apple1","apple2","apple3","apple4"};
      @Override
      protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
        //Remove title bar
        this.requestWindowFeature(Window.FEATURE_NO_TITLE); 
        setContentView(R.layout.activity_sendemail_screen);
        autoText = (AutoCompleteTextView)findViewById(R.id.AutoCompleteTextView_email_to);
        ArrayAdapter<String> adapter =  new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,president);
        autoText.setThreshold(2);
        autoText.setAdapter(adapter);

    }

.XML

    <TableLayout
       android:id="@+id/tableLayout_personalinfo_memsa"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:layout_margin="5sp"
       android:padding="10sp"
       android:shrinkColumns="*">

    <TableRow
           android:id="@+id/tablerow_email_to"
           android:layout_width="fill_parent"
           android:layout_height="wrap_content">

       <AutoCompleteTextView
           android:id="@+id/AutoCompleteTextView_email_to"
           android:layout_width="0sp"
           android:layout_height="fill_parent"
           android:layout_weight=".7"
           android:padding="10sp"
           android:imeOptions="actionDone"
           android:dropDownSelector="@drawable/selected_state"
           android:background="@drawable/subscription_textarea_gray"
           android:hint="@string/hint_sms_to"/>

       <Button 
           android:id="@+id/button_send_email"
           android:layout_width="0sp"
           android:layout_height="fill_parent"
           android:layout_weight=".3"
           android:contentDescription="@string/string_test"
           android:text="@string/string_email_send"/>
      </TableRow>
        </TableLayout>

0 个答案:

没有答案