Java Code Examples for android.widget.Button#setFocusable()
The following examples show how to use
android.widget.Button#setFocusable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PaneledChoiceDialog.java From commcare-android with Apache License 2.0 | 6 votes |
public static void populateChoicePanel(Context context, Button choicePanel, DialogChoiceItem item, boolean iconToLeft) { choicePanel.setText(item.text); if (item.listener != null) { choicePanel.setOnClickListener(item.listener); } else { // needed to propagate clicks down to the ListView's ItemClickListener choicePanel.setFocusable(false); choicePanel.setClickable(false); } if (item.iconResId != -1) { Drawable icon = ContextCompat.getDrawable(context, item.iconResId); if (iconToLeft) { if (LocalePreferences.isLocaleRTL()) choicePanel.setCompoundDrawablesWithIntrinsicBounds(null, null, icon, null); else choicePanel.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); } else { choicePanel.setCompoundDrawablesWithIntrinsicBounds(null, icon, null, null); } } }
Example 2
Source File: LeftMenuPresenter.java From AndroidTVWidget with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(ViewHolder viewHolder, int position) { Button btn = (Button) viewHolder.view; btn.setFocusableInTouchMode(true); // 只是测试鼠标效果. btn.setFocusable(true); String str = strList.get(position); btn.setText(str); }
Example 3
Source File: LeftMenuPresenter.java From Android-tv-widget with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(ViewHolder viewHolder, int position) { Button btn = (Button) viewHolder.view; btn.setFocusableInTouchMode(true); // 只是测试鼠标效果. btn.setFocusable(true); String str = strList.get(position); btn.setText(str); }
Example 4
Source File: PhonebookAdapter.java From ui with Apache License 2.0 | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup viewGroup) { Phonebook entry = listPhonebook.get(position); if (convertView == null) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.phone_row, null); } TextView tvContact = (TextView) convertView.findViewById(R.id.tvContact); tvContact.setText(entry.getName()); TextView tvPhone = (TextView) convertView.findViewById(R.id.tvMobile); tvPhone.setText(entry.getPhone()); TextView tvMail = (TextView) convertView.findViewById(R.id.tvMail); tvMail.setText(entry.getMail()); // Set the onClick Listener on this button Button btnRemove = (Button) convertView.findViewById(R.id.btnRemove); btnRemove.setFocusableInTouchMode(false); btnRemove.setFocusable(false); btnRemove.setOnClickListener(this); // Set the entry, so that you can capture which item was clicked and // then remove it // As an alternative, you can use the id/position of the item to capture // the item that was clicked. // btnRemove.setId(position); btnRemove.setTag(entry); return convertView; }
Example 5
Source File: Phonebook_myAdapter.java From ui with Apache License 2.0 | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup viewGroup) { Phonebook_DataModel entry = listPhonebook.get(position); if (convertView == null) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.phonebook_rowlayout, null); } TextView tvContact = (TextView) convertView.findViewById(R.id.tvContact); tvContact.setText(entry.getName()); TextView tvPhone = (TextView) convertView.findViewById(R.id.tvMobile); tvPhone.setText(entry.getPhone()); TextView tvMail = (TextView) convertView.findViewById(R.id.tvMail); tvMail.setText(entry.getMail()); // Set the onClick Listener on this button Button btnRemove = (Button) convertView.findViewById(R.id.btnRemove); btnRemove.setFocusableInTouchMode(false); btnRemove.setFocusable(false); btnRemove.setOnClickListener(this); // Set the entry, so that you can capture which item was clicked and // then remove it // As an alternative, you can use the id/position of the item to capture // the item that was clicked. // btnRemove.setId(position); btnRemove.setTag(entry); return convertView; }
Example 6
Source File: Phonebook_myAdapter.java From ui with Apache License 2.0 | 5 votes |
public ViewHolder(View itemView) { super(itemView); tvContact = (TextView) itemView.findViewById(R.id.tvContact); tvPhone = (TextView) itemView.findViewById(R.id.tvMobile); tvMail = (TextView) itemView.findViewById(R.id.tvMail); btnRemove = (Button) itemView.findViewById(R.id.btnRemove); btnRemove.setFocusableInTouchMode(false); btnRemove.setFocusable(false); }
Example 7
Source File: ZenMenuAdapter.java From zen4android with MIT License | 5 votes |
@Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { Map<String, String> map = (Map<String, String>)mHeaders.get(groupPosition); String text = (String)map.get("name"); if(convertView == null) { convertView = mInflater.inflate(R.layout.zen_menu_group, null); } ImageButton itemLeft = (ImageButton)convertView.findViewById(R.id.zen_menu_header_left); Button itemRight = (Button)convertView.findViewById(R.id.zen_menu_header_right); itemRight.setText(text); itemLeft.setImageResource(R.drawable.menu_right_arrow); if(isExpanded) { itemLeft.setImageResource(R.drawable.menu_down_arrow); } int background = menu_item_backgrounds[groupPosition%9]; itemLeft.setBackgroundResource(background); itemRight.setBackgroundResource(background); itemLeft.setFocusable(false); itemRight.setFocusable(false); itemLeft.setClickable(false); itemRight.setClickable(false); return convertView; }