本文整理汇总了Java中android.widget.LinearLayout.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java LinearLayout.getParent方法的具体用法?Java LinearLayout.getParent怎么用?Java LinearLayout.getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.getParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createListenerLog
import android.widget.LinearLayout; //导入方法依赖的package包/类
static void createListenerLog(LinearLayout messagesContainer, String text) {
String currentDateTime = new SimpleDateFormat("HH:mm:ss.SSS", Locale.getDefault()).format(new Date());
TextView textView = new TextView(messagesContainer.getContext());
textView.setTextColor(Color.WHITE);
textView.setTextSize(14);
textView.setText(currentDateTime + ": " + text);
messagesContainer.addView(textView);
final ScrollView scrollView = (ScrollView)messagesContainer.getParent();
scrollView.post(new Runnable() {
public void run() {
scrollView.fullScroll(ScrollView.FOCUS_DOWN);
}
});
}
示例2: onClick
import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
if (v instanceof ImageView) {//onClick CloseIcon
//v.getParent() -> parent of closeIcon
LinearLayout lnlChild = (LinearLayout) v.getParent();
LinearLayout lnlContainer = (LinearLayout) lnlChild.getParent();
int pillPosition = (int) (lnlContainer).getTag();
if (onPillClickListener != null) {
onPillClickListener.onCloseIconClick(this, pillPosition);
}
} else {
//onClick for lnlContainer
int linearLayoutPosition = (int) v.getTag();
PillEntity pillEntity = (PillEntity) (objectList.get(linearLayoutPosition));
if (selectionMode == DEFAULT_MODE_MULTI_SELECTION) {
if (pillEntity.isPressed()) {
pillEntity.setPressed(false);
v.setBackgroundResource(backgroundPill);
} else {
pillEntity.setPressed(true);
v.setBackgroundResource(backgroundPillSelected);
}
}
if (onPillClickListener != null) {
onPillClickListener.onPillClick(this, linearLayoutPosition);
}
}
}
示例3: getLayoutDepth
import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
* Procedure returns the layout depth of this term related to mainView
*/
public static int getLayoutDepth(LinearLayout l)
{
int retValue = 0;
if (l == null)
{
return retValue;
}
ViewParent p = l.getParent();
while (p != null)
{
if (p instanceof TwoDScrollView)
{
if (((TwoDScrollView) p).getId() == R.id.main_scroll_view)
{
break;
}
}
if (p instanceof FormulaBase && p.getParent() == null)
{
retValue += 2;
break;
}
retValue++;
p = p.getParent();
}
return retValue;
}