Android: orientation="vertical" android: layout width="match parent"
Download 14.53 Kb.
|
Royxat actvity
Bu yerdagi royhatda_actvity=va dizaynida: android:layout_width="match_parent" android:background="@color/purple_200" android:layout_height="wrap_content" android:gravity="center"> android:layout_height="wrap_content" android:text="Name" android:textSize="30dp" android:gravity="center"> android:layout_height="wrap_content" android:text="Name" android:textSize="30dp" android:gravity="center"> android:layout_height="wrap_content" android:text="Name" android:textSize="30dp" android:gravity="center"> android:layout_height="wrap_content" android:text="ADD" android:layout_margin="50dp"> ??????? Bu esa kod qismi: public class activty_royxatlar extends AppCompatActivity { ListView listView; AppCompatButton btn_add; EditText edit_name; String[]foyddalanuvchilar={"akbar","san`atbek","diyorbek"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_activty_royxatlar); btn_add=findViewById(R.id.btn_addd); edit_name=findViewById(R.id.id_edit_name); listView=findViewById(R.id.list_view); ArrayAdapter listView.setAdapter(arrayAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView> adapterView, View view, int i, long l) { Toast.makeText(activty_royxatlar.this,"foyddalanuvchilar[i]",Toast.LENGTH_SHORT).show(); } }); btn_add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!edit_name.getText().toString().equals("")) { foyddalanuvchilar.equals(edit_name.getText().toString()); edit_name.setText(""); }else { Toast.makeText(activty_royxatlar.this,"Maydon bosh!",Toast.LENGTH_SHORT); }
} } Download 14.53 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling