1
我有一個contextMenu它包含兩個項目Edit和Delete!但是因爲我正在寫我的國家語言......項目應該是正確的對齊! 以下是我的代碼。請指導我,謝謝!ContextMenu從右到左
public class ListActivity extends AppCompatActivity {
ListView lst_data;
DicDBAdapter dicDBAdapter;
Dic dic;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
lst_data = (ListView) findViewById(R.id.lst_data);
dicDBAdapter = new DicDBAdapter(getApplicationContext());
ArrayList<String> arrayList = dicDBAdapter.getdata();
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getApplicationContext(),
android.R.layout.simple_dropdown_item_1line,
arrayList);
lst_data.setAdapter(arrayAdapter);
registerForContextMenu(lst_data);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
getMenuInflater().inflate(R.menu.context, menu);
}