本文整理汇总了Java中android.widget.LinearLayout.setFocusable方法的典型用法代码示例。如果您正苦于以下问题:Java LinearLayout.setFocusable方法的具体用法?Java LinearLayout.setFocusable怎么用?Java LinearLayout.setFocusable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.setFocusable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createApplications
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void createApplications() {
mContainer.removeAllViews();
mGridX = mSetup.getGridX();
mGridY = mSetup.getGridY();
if (mGridX < 2)
mGridX = 2;
if (mGridY < 1)
mGridY = 1;
int marginX = Utils.getPixelFromDp(getContext(), mSetup.getMarginX());
int marginY = Utils.getPixelFromDp(getContext(), mSetup.getMarginY());
boolean showNames = mSetup.showNames();
mApplications = new ApplicationView[mGridY][mGridX];
int position = 0;
for (int y = 0; y < mGridY; y++) {
LinearLayout ll = new LinearLayout(getContext());
ll.setOrientation(LinearLayout.HORIZONTAL);
ll.setGravity(Gravity.CENTER_VERTICAL);
ll.setFocusable(false);
ll.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, 0, 1
));
for (int x = 0; x < mGridX; x++) {
ApplicationView av = new ApplicationView(getContext());
av.setOnClickListener(this);
av.setOnLongClickListener(this);
av.setOnMenuOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onLongClick(v);
}
});
av.setPosition(position++);
av.showName(showNames);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
av.setId(0x00FFFFFF + position);
} else {
av.setId(View.generateViewId());
}
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1);
lp.setMargins(marginX, marginY, marginX, marginY);
av.setLayoutParams(lp);
ll.addView(av);
mApplications[y][x] = av;
}
mContainer.addView(ll);
}
updateApplications();
setApplicationOrder();
}