将布局发送到布局背面

时间:2017-05-30 20:51:52

标签: java android layout android-relativelayout programmatically

我正在尝试添加列表会话标题并在后面添加隐藏按钮。

请帮我将Del Button和Edit Button发送到会话标题后面。它将在滑动后查看。

我也尝试过onToFront和sendToBack on钮,这些按钮有效。

要设置Z顺序,我需要将Project min SDK设置为21,我不想这样做。所以我也不能使用Z顺序。

 RelativeLayout SupRelLyoVar = new RelativeLayout(KxtVar);
 RelativeLayout.LayoutParams NamLysHtrRloRulVaj = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, LyHtrHytVal);
 SupRelLyoVar.setLayoutParams(NamLysHtrRloRulVaj);

 Button DelBtnVav = new Button(KxtVar);
 DelBtnVav.setId(View.generateViewId());
 RelativeLayout.LayoutParams DelBtnRulVaj = new RelativeLayout.LayoutParams(LyHtrHytVal, LyHtrHytVal);
 DelBtnRulVaj.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
 DelBtnVav.setLayoutParams(DelBtnRulVaj);
 SupRelLyoVar.addView(DelBtnVav);

 Button EdtBtnVav = new Button(KxtVar);
 RelativeLayout.LayoutParams EdtBtnRulVaj = new RelativeLayout.LayoutParams(LyHtrHytVal, LyHtrHytVal);
 EdtBtnRulVaj.addRule(RelativeLayout.LEFT_OF, DelBtnVav.getId());
 EdtBtnVav.setLayoutParams(EdtBtnRulVaj);
 SupRelLyoVar.addView(EdtBtnVav);

 LinearLayout LnrLyoVar = new LinearLayout(KxtVar);
 LnrLyoVar.setBackgroundColor(SsnHtrBgdClr);
 RelativeLayout.LayoutParams LnrLyoRulVaj = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, LyHtrHytVal);
 LnrLyoRulVaj.addRule(RelativeLayout.CENTER_IN_PARENT);

 TextView TxtVyuVav = new TextView(KxtVar);
 LinearLayout.LayoutParams LysHtrTxtVyuRulVaj = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
 TxtVyuVav.setLayoutParams(LysHtrTxtVyuRulVaj);
 LnrLyoVar.addView(TxtVyuVav);

 SupRelLyoVar.addView(LnrLyoVar, LnrLyoRulVaj);

enter image description here

1 个答案:

答案 0 :(得分:0)

我有解决方案,喜欢发帖 这是为了所有我不想像我一样挣扎的人。

| * |设置OnTouchListener:

kivy/core/image/__init__.py

| * |使用以下外部功能:

LnrLyoVar.setOnTouchListener(WkaMovLitRitVyuKlkVaf);