com.extjs.gxt.ui.client.widget.button.Button.getParent()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(170)

本文整理了Java中com.extjs.gxt.ui.client.widget.button.Button.getParent()方法的一些代码示例,展示了Button.getParent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.getParent()方法的具体详情如下:
包路径:com.extjs.gxt.ui.client.widget.button.Button
类名称:Button
方法名:getParent

Button.getParent介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

  1. Button yourBtn = (Button) findViewById(R.id.your_btn);
  2. RelativeLayout yourRelLay = (RelativeLayout) yourBtn.getParent();

代码示例来源:origin: stackoverflow.com

  1. Button button = (Button) findViewById(view.getId());
  2. LinearLayout rLGreen = ((LinearLayout) button.getParent());
  3. rLGreen.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

代码示例来源:origin: stackoverflow.com

  1. AlertDialog.Builder builder;
  2. builder = new AlertDialog.Builder(context, R.style.StackedAlertDialogStyle);
  3. builder.setTitle("Title");
  4. builder.setMessage("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dignissim purus eget gravida mollis. Integer in auctor turpis. Morbi auctor, diam eget vestibulum congue, quam arcu pulvinar dui, blandit egestas erat enim non ligula." +
  5. " Nunc quis laoreet libero. Aliquam consectetur nibh eu arcu eleifend efficitur.");
  6. builder.setPositiveButton("Positive Button", new DialogInterface.OnClickListener() {
  7. @Override
  8. public void onClick(DialogInterface dialog, int which) {
  9. }
  10. });
  11. builder.setNeutralButton("Neutral Button", new DialogInterface.OnClickListener() {
  12. @Override
  13. public void onClick(DialogInterface dialog, int which) {
  14. }
  15. });
  16. builder.setNegativeButton("Cancel Button", new DialogInterface.OnClickListener() {
  17. @Override
  18. public void onClick(DialogInterface dialog, int which) {
  19. }
  20. });
  21. AlertDialog alertDialog = builder.create();
  22. alertDialog.show();
  23. try{
  24. final Button button = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
  25. LinearLayout linearLayout = (LinearLayout) button.getParent();
  26. linearLayout.setOrientation(LinearLayout.VERTICAL);
  27. } catch(Exception ex){
  28. //ignore it
  29. }

代码示例来源:origin: stackoverflow.com

  1. TableRow tableRow;
  2. TextView tv;
  3. Button button;
  4. //...
  5. tableRow.addView(tv)
  6. tableRow.addView(button);
  7. //somewhere where you want to delete
  8. ViewGroup parent=button.getParent();
  9. if(parent instanceof TableRow)
  10. //do deleting task

代码示例来源:origin: stackoverflow.com

  1. Object s = event.getSource();
  2. Button sButton = (Button)s;
  3. sButton.getParent().removeFromParent();
  4. RootPanel.get("a").add(nextPanel);

代码示例来源:origin: stackoverflow.com

  1. Button button = (Button) findViewById(view.getId());
  2. LinearLayout rLGreen = ((LinearLayout) button.getParent());
  3. rLGreen.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

代码示例来源:origin: stackoverflow.com

  1. // post a runnable to the parent view's message queue so its run after
  2. // the view is drawn
  3. parent.post(new Runnable() {
  4. @Override
  5. public void run() {
  6. Rect delegateArea = new Rect();
  7. Button delegate = TouchDelegateSample.this.mButton;
  8. delegate.getHitRect(delegateArea);
  9. delegateArea.top -= 200;
  10. TouchDelegate expandedArea = new TouchDelegate(delegateArea, delegate);
  11. // give the delegate to an ancestor of the view we're delegating the
  12. // area to
  13. if (View.class.isInstance(delegate.getParent())) {
  14. ((View)delegate.getParent()).setTouchDelegate(expandedArea);
  15. }
  16. }
  17. }); } }

代码示例来源:origin: stackoverflow.com

  1. ScrollView mScrollView = (ScrollView) findViewById(R.id.scroll_view);
  2. mScrollView.post(new Runnable() {
  3. public void run() {
  4. Button btn = (Button) findViewById(k);
  5. ViewGroup vg =(ViewGroup)btn.getParent();
  6. mScrollView.smoothScrollTo(0,vg.getTop());
  7. }});
  8. }

代码示例来源:origin: stackoverflow.com

  1. if (View.class.isInstance(delegate.getParent())) {
  2. ((View)delegate.getParent()).setTouchDelegate(expandedArea);

代码示例来源:origin: stackoverflow.com

  1. if (View.class.isInstance(delegate.getParent())) {
  2. ((View) delegate.getParent())
  3. .setTouchDelegate(expandedArea);

代码示例来源:origin: stackoverflow.com

  1. /** Called when the activity is first created. */
  2. @Override
  3. public void onCreate(Bundle savedInstanceState) {
  4. super.onCreate(savedInstanceState);
  5. setContentView(R.layout.main);
  6. mButton = (Button) findViewById(R.id.delegated_button);
  7. View parent = findViewById(R.id.root);
  8. parent.post(new Runnable() {
  9. public void run() {
  10. // Post in the parent's message queue to make sure the parent
  11. // lays out its children before we call getHitRect()
  12. Rect delegateArea = new Rect();
  13. Button delegate = mButton;
  14. delegate.getHitRect(delegateArea);
  15. delegateArea.top -= 600;
  16. delegateArea.bottom += 600;
  17. delegateArea.left -= 600;
  18. delegateArea.right += 600;
  19. TouchDelegate expandedArea = new TouchDelegate(delegateArea,
  20. delegate);
  21. // give the delegate to an ancestor of the view we're
  22. // delegating the
  23. // area to
  24. if (View.class.isInstance(delegate.getParent())) {
  25. ((View) delegate.getParent())
  26. .setTouchDelegate(expandedArea);
  27. }
  28. };
  29. });
  30. }

代码示例来源:origin: stackoverflow.com

  1. Button startingButton = findViewById(R.id.startingButton);
  2. ViewParent v = startingButton.getParent();
  3. while(v != null) {
  4. System.out.println(String.valueOf(v.getId()) + " : " + v.getClass().getName());
  5. v = v.getParent();
  6. }

代码示例来源:origin: stackoverflow.com

  1. // Show alertDialog after building
  2. AlertDialog alertDialog = createAlertDialog(context);
  3. alertDialog.show();
  4. // and find positiveButton and negativeButton
  5. Button positiveButton = (Button) alertDialog.findViewById(android.R.id.button1);
  6. Button negativeButton = (Button) alertDialog.findViewById(android.R.id.button2);
  7. // then get their parent ViewGroup
  8. ViewGroup buttonPanelContainer = (ViewGroup) positiveButton.getParent();
  9. int positiveButtonIndex = buttonPanelContainer.indexOfChild(positiveButton);
  10. int negativeButtonIndex = buttonPanelContainer.indexOfChild(negativeButton);
  11. if (positiveButtonIndex < negativeButtonIndex) {
  12. // prepare exchange their index in ViewGroup
  13. buttonPanelContainer.removeView(positiveButton);
  14. buttonPanelContainer.removeView(negativeButton);
  15. buttonPanelContainer.addView(negativeButton, positiveButtonIndex);
  16. buttonPanelContainer.addView(positiveButton, negativeButtonIndex);
  17. }

代码示例来源:origin: stackoverflow.com

  1. AlertDialog.Builder builder;
  2. builder = new AlertDialog.Builder(context, R.style.StackedAlertDialogStyle);
  3. builder.setTitle("Title");
  4. builder.setMessage("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dignissim purus eget gravida mollis. Integer in auctor turpis. Morbi auctor, diam eget vestibulum congue, quam arcu pulvinar dui, blandit egestas erat enim non ligula." +
  5. " Nunc quis laoreet libero. Aliquam consectetur nibh eu arcu eleifend efficitur.");
  6. builder.setPositiveButton("Positive Button", new DialogInterface.OnClickListener() {
  7. @Override
  8. public void onClick(DialogInterface dialog, int which) {
  9. }
  10. });
  11. builder.setNeutralButton("Neutral Button", new DialogInterface.OnClickListener() {
  12. @Override
  13. public void onClick(DialogInterface dialog, int which) {
  14. }
  15. });
  16. builder.setNegativeButton("Cancel Button", new DialogInterface.OnClickListener() {
  17. @Override
  18. public void onClick(DialogInterface dialog, int which) {
  19. }
  20. });
  21. AlertDialog alertDialog = builder.create();
  22. alertDialog.show();
  23. try{
  24. final Button button = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
  25. LinearLayout linearLayout = (LinearLayout) button.getParent();
  26. linearLayout.setOrientation(LinearLayout.VERTICAL);
  27. } catch(Exception ex){
  28. //ignore it
  29. }

代码示例来源:origin: stackoverflow.com

  1. // Show alertDialog after building
  2. AlertDialog alertDialog = createAlertDialog(context);
  3. alertDialog.show();
  4. // and find positiveButton and negativeButton
  5. Button positiveButton = (Button) alertDialog.findViewById(android.R.id.button1);
  6. Button negativeButton = (Button) alertDialog.findViewById(android.R.id.button2);
  7. // then get their parent ViewGroup
  8. ViewGroup buttonPanelContainer = (ViewGroup) positiveButton.getParent();
  9. int positiveButtonIndex = buttonPanelContainer.indexOfChild(positiveButton);
  10. int negativeButtonIndex = buttonPanelContainer.indexOfChild(negativeButton);
  11. if (positiveButtonIndex < negativeButtonIndex) {
  12. // prepare exchange their index in ViewGroup
  13. buttonPanelContainer.removeView(positiveButton);
  14. buttonPanelContainer.removeView(negativeButton);
  15. buttonPanelContainer.addView(negativeButton, positiveButtonIndex);
  16. buttonPanelContainer.addView(positiveButton, negativeButtonIndex);
  17. }

代码示例来源:origin: com.extjs/gxt

  1. @Override
  2. public void onTab(Component component, PreviewEvent pe) {
  3. if (!isManaged()) return;
  4. Menu menu = (Menu)component;
  5. if (menu.isVisible()) {
  6. Button btn = menu.getData("parent");
  7. if (btn != null) {
  8. pe.preventDefault();
  9. btn.hideMenu();
  10. focusNextWidget(btn.getParent());
  11. }
  12. }
  13. }

代码示例来源:origin: stackoverflow.com

  1. public void onClick(View arg0) {
  2. final ViewGroup container = (ViewGroup) button.getParent().getParent();
  3. container.getOverlay().add(button);

相关文章