本文整理汇总了Java中android.view.View.setDuplicateParentStateEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java View.setDuplicateParentStateEnabled方法的具体用法?Java View.setDuplicateParentStateEnabled怎么用?Java View.setDuplicateParentStateEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.setDuplicateParentStateEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeAdapter
import android.view.View; //导入方法依赖的package包/类
private void changeAdapter() {
removeAllViews();
TagAdapter adapter = this.mTagAdapter;
HashSet preCheckedList = this.mTagAdapter.getPreCheckedList();
for (int i = 0; i < adapter.getCount(); i++) {
View tagView = adapter.getView(this, i, adapter.getItem(i));
TagView tagViewContainer = new TagView(getContext());
tagView.setDuplicateParentStateEnabled(true);
tagViewContainer.setLayoutParams(tagView.getLayoutParams());
tagViewContainer.addView(tagView);
addView(tagViewContainer);
if (preCheckedList.contains(Integer.valueOf(i))) {
tagViewContainer.setChecked(true);
}
}
this.mSelectedView.addAll(preCheckedList);
}
示例2: dispatchChildren
import android.view.View; //导入方法依赖的package包/类
/**
* 设置子视图与父控件perssed 等状态保持一致
*
* @param view 各级子控件
*/
private void dispatchChildren(View view) {
// 子视图与父控件perssed 等状态保持一致
view.setDuplicateParentStateEnabled(true);
if (view instanceof ViewGroup && ((ViewGroup) view).getChildCount() > 0) {
for (int i = 0; i < getChildCount(); i++) {
dispatchChildren(((ViewGroup) view).getChildAt(i));
}
}
}
示例3: changeAdapter
import android.view.View; //导入方法依赖的package包/类
private void changeAdapter() {
removeAllViews();
TagAdapter adapter = mTagAdapter;
TagView tagViewContainer = null;
HashSet preCheckedList = mTagAdapter.getPreCheckedList();
for (int i = 0; i < adapter.getCount(); i++) {
View tagView = adapter.getView(this, i, adapter.getItem(i));
tagViewContainer = new TagView(getContext());
tagView.setDuplicateParentStateEnabled(true);
if (tagView.getLayoutParams() != null) {
tagViewContainer.setLayoutParams(tagView.getLayoutParams());
} else {
ViewGroup.MarginLayoutParams lp = new ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
lp.setMargins(dip2px(getContext(), 5),
dip2px(getContext(), 5),
dip2px(getContext(), 5),
dip2px(getContext(), 5));
tagViewContainer.setLayoutParams(lp);
}
tagViewContainer.addView(tagView);
addView(tagViewContainer);
if (preCheckedList.contains(i)) {
tagViewContainer.setChecked(true);
}
if (mTagAdapter.setSelected(i, adapter.getItem(i))) {
mSelectedView.add(i);
tagViewContainer.setChecked(true);
}
}
mSelectedView.addAll(preCheckedList);
}
示例4: changeAdapter
import android.view.View; //导入方法依赖的package包/类
private void changeAdapter() {
removeAllViews();
TagAdapter adapter = mTagAdapter;
TagView tagViewContainer = null;
HashSet preCheckedList = mTagAdapter.getPreCheckedList();
for (int i = 0; i < adapter.getCount(); i++) {
View tagView = adapter.getView(this, i, adapter.getItem(i));
tagViewContainer = new TagView(getContext());
// ViewGroup.MarginLayoutParams clp = (ViewGroup.MarginLayoutParams) tagView.getLayoutParams();
// ViewGroup.MarginLayoutParams lp = new ViewGroup.MarginLayoutParams(clp);
// lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
// lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
// lp.topMargin = clp.topMargin;
// lp.bottomMargin = clp.bottomMargin;
// lp.leftMargin = clp.leftMargin;
// lp.rightMargin = clp.rightMargin;
tagView.setDuplicateParentStateEnabled(true);
if (tagView.getLayoutParams() != null) {
tagViewContainer.setLayoutParams(tagView.getLayoutParams());
} else {
MarginLayoutParams lp = new MarginLayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.setMargins(dip2px(getContext(), 5),
dip2px(getContext(), 5),
dip2px(getContext(), 5),
dip2px(getContext(), 5));
tagViewContainer.setLayoutParams(lp);
}
tagViewContainer.addView(tagView);
addView(tagViewContainer);
if (preCheckedList.contains(i)) {
tagViewContainer.setChecked(true);
}
if (mTagAdapter.setSelected(i, adapter.getItem(i))) {
mSelectedView.add(i);
tagViewContainer.setChecked(true);
}
}
mSelectedView.addAll(preCheckedList);
}
示例5: changeAdapter
import android.view.View; //导入方法依赖的package包/类
private void changeAdapter()
{
removeAllViews();
TagAdapter adapter = mTagAdapter;
TagView tagViewContainer = null;
HashSet preCheckedList = mTagAdapter.getPreCheckedList();
for (int i = 0; i < adapter.getCount(); i++)
{
View tagView = adapter.getView(this, i, adapter.getItem(i));
tagViewContainer = new TagView(getContext());
// ViewGroup.MarginLayoutParams clp = (ViewGroup.MarginLayoutParams) tagView.getLayoutParams();
// ViewGroup.MarginLayoutParams lp = new ViewGroup.MarginLayoutParams(clp);
// lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
// lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
// lp.topMargin = clp.topMargin;
// lp.bottomMargin = clp.bottomMargin;
// lp.leftMargin = clp.leftMargin;
// lp.rightMargin = clp.rightMargin;
tagView.setDuplicateParentStateEnabled(true);
if (tagView.getLayoutParams() != null)
{
tagViewContainer.setLayoutParams(tagView.getLayoutParams());
} else
{
MarginLayoutParams lp = new MarginLayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.setMargins(dip2px(getContext(), 5),
dip2px(getContext(), 5),
dip2px(getContext(), 5),
dip2px(getContext(), 5));
tagViewContainer.setLayoutParams(lp);
}
tagViewContainer.addView(tagView);
addView(tagViewContainer);
if (preCheckedList.contains(i))
{
tagViewContainer.setChecked(true);
}
if (mTagAdapter.setSelected(i, adapter.getItem(i)))
{
mSelectedView.add(i);
tagViewContainer.setChecked(true);
}
}
mSelectedView.addAll(preCheckedList);
}