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

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

本文整理了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

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

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

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

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

AlertDialog.Builder builder;
 builder = new AlertDialog.Builder(context, R.style.StackedAlertDialogStyle);
 builder.setTitle("Title");
 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." +
     " Nunc quis laoreet libero. Aliquam consectetur nibh eu arcu eleifend efficitur.");
 builder.setPositiveButton("Positive Button", new DialogInterface.OnClickListener() {
   @Override
   public void onClick(DialogInterface dialog, int which) {
   }
 });
 builder.setNeutralButton("Neutral Button", new DialogInterface.OnClickListener() {
   @Override
   public void onClick(DialogInterface dialog, int which) {
   }
 });
 builder.setNegativeButton("Cancel Button", new DialogInterface.OnClickListener() {
   @Override
   public void onClick(DialogInterface dialog, int which) {
   }
 });
 AlertDialog alertDialog = builder.create();
 alertDialog.show();
   try{
     final Button button = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
     LinearLayout linearLayout = (LinearLayout) button.getParent();
     linearLayout.setOrientation(LinearLayout.VERTICAL);
   } catch(Exception ex){
     //ignore it
   }

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

TableRow tableRow;
 TextView tv;
 Button button;
 //...
 tableRow.addView(tv)
 tableRow.addView(button);
 //somewhere where you want to delete
 ViewGroup parent=button.getParent();
 if(parent instanceof TableRow)
   //do deleting task

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

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

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

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

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

// post a runnable to the parent view's message queue so its run after
// the view is drawn
parent.post(new Runnable() {
 @Override
 public void run() {
  Rect delegateArea = new Rect();
  Button delegate = TouchDelegateSample.this.mButton;
  delegate.getHitRect(delegateArea);
  delegateArea.top -= 200;
  TouchDelegate expandedArea = new TouchDelegate(delegateArea, delegate);
  // give the delegate to an ancestor of the view we're delegating the
  // area to
  if (View.class.isInstance(delegate.getParent())) {
   ((View)delegate.getParent()).setTouchDelegate(expandedArea);
  }
 }
});   } }

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

ScrollView mScrollView = (ScrollView) findViewById(R.id.scroll_view);
mScrollView.post(new Runnable() {
  public void run() { 
    Button btn = (Button) findViewById(k); 
    ViewGroup vg =(ViewGroup)btn.getParent();
    mScrollView.smoothScrollTo(0,vg.getTop());
   }});
}

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

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

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

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

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

/** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
   mButton = (Button) findViewById(R.id.delegated_button);
   View parent = findViewById(R.id.root);
   parent.post(new Runnable() {
     public void run() {
       // Post in the parent's message queue to make sure the parent
       // lays out its children before we call getHitRect()
       Rect delegateArea = new Rect();
       Button delegate = mButton;
       delegate.getHitRect(delegateArea);
       delegateArea.top -= 600;
       delegateArea.bottom += 600;
       delegateArea.left -= 600;
       delegateArea.right += 600;
       TouchDelegate expandedArea = new TouchDelegate(delegateArea,
           delegate);
       // give the delegate to an ancestor of the view we're
       // delegating the
       // area to
       if (View.class.isInstance(delegate.getParent())) {
         ((View) delegate.getParent())
             .setTouchDelegate(expandedArea);
       }
     };
   });
 }

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

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

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

// Show alertDialog after building
AlertDialog alertDialog = createAlertDialog(context);
alertDialog.show();
// and find positiveButton and negativeButton
Button positiveButton = (Button) alertDialog.findViewById(android.R.id.button1);
Button negativeButton = (Button) alertDialog.findViewById(android.R.id.button2);
// then get their parent ViewGroup
ViewGroup buttonPanelContainer = (ViewGroup) positiveButton.getParent();
int positiveButtonIndex = buttonPanelContainer.indexOfChild(positiveButton);
int negativeButtonIndex = buttonPanelContainer.indexOfChild(negativeButton);
if (positiveButtonIndex < negativeButtonIndex) {
  // prepare exchange their index in ViewGroup
  buttonPanelContainer.removeView(positiveButton);
  buttonPanelContainer.removeView(negativeButton);
  buttonPanelContainer.addView(negativeButton, positiveButtonIndex);
  buttonPanelContainer.addView(positiveButton, negativeButtonIndex);
}

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

AlertDialog.Builder builder;
 builder = new AlertDialog.Builder(context, R.style.StackedAlertDialogStyle);
 builder.setTitle("Title");
 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." +
     " Nunc quis laoreet libero. Aliquam consectetur nibh eu arcu eleifend efficitur.");
 builder.setPositiveButton("Positive Button", new DialogInterface.OnClickListener() {
   @Override
   public void onClick(DialogInterface dialog, int which) {
   }
 });
 builder.setNeutralButton("Neutral Button", new DialogInterface.OnClickListener() {
   @Override
   public void onClick(DialogInterface dialog, int which) {
   }
 });
 builder.setNegativeButton("Cancel Button", new DialogInterface.OnClickListener() {
   @Override
   public void onClick(DialogInterface dialog, int which) {
   }
 });
 AlertDialog alertDialog = builder.create();
 alertDialog.show();
   try{
     final Button button = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
     LinearLayout linearLayout = (LinearLayout) button.getParent();
     linearLayout.setOrientation(LinearLayout.VERTICAL);
   } catch(Exception ex){
     //ignore it
   }

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

// Show alertDialog after building
 AlertDialog alertDialog = createAlertDialog(context);
 alertDialog.show();
 // and find positiveButton and negativeButton
 Button positiveButton = (Button) alertDialog.findViewById(android.R.id.button1);
 Button negativeButton = (Button) alertDialog.findViewById(android.R.id.button2);
 // then get their parent ViewGroup
 ViewGroup buttonPanelContainer = (ViewGroup) positiveButton.getParent();
 int positiveButtonIndex = buttonPanelContainer.indexOfChild(positiveButton);
 int negativeButtonIndex = buttonPanelContainer.indexOfChild(negativeButton);
 if (positiveButtonIndex < negativeButtonIndex) {
   // prepare exchange their index in ViewGroup
   buttonPanelContainer.removeView(positiveButton);
   buttonPanelContainer.removeView(negativeButton);
   buttonPanelContainer.addView(negativeButton, positiveButtonIndex);
   buttonPanelContainer.addView(positiveButton, negativeButtonIndex);
 }

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

@Override
public void onTab(Component component, PreviewEvent pe) {
 if (!isManaged()) return;
 Menu menu = (Menu)component;
 if (menu.isVisible()) {
  Button btn = menu.getData("parent");
  if (btn != null) {
   pe.preventDefault();
   btn.hideMenu();
   focusNextWidget(btn.getParent());
  }
 }
}

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

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

相关文章