本文整理汇总了Java中android.widget.LinearLayout.setMinimumHeight方法的典型用法代码示例。如果您正苦于以下问题:Java LinearLayout.setMinimumHeight方法的具体用法?Java LinearLayout.setMinimumHeight怎么用?Java LinearLayout.setMinimumHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.setMinimumHeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
// Set the text view as the activity layout
View view = inflater.inflate(R.layout.fragment_feedback, container, false);
this.view = view;
FloatingActionButton sendButton = view.findViewById(R.id.floating_button_send_feedback);
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendMessage();
}
});
LinearLayout linearLayout = view.findViewById(R.id.linearlayout_desc);
linearLayout.setMinimumHeight((int) (1.6*((double) view.getResources().getDimension(R.dimen.abc_action_bar_default_height_material))));
return view;
}
示例2: createToastView
import android.widget.LinearLayout; //导入方法依赖的package包/类
private static View createToastView(Context context) {
RelativeLayout root = new RelativeLayout(context);
root.setTag("root");
if (isSupport()) {
root.setBackgroundResource(context.getResources().getIdentifier("colorAccent", "color", context.getPackageName()));
}
//root.setBackgroundColor(Color.RED);
WindowManager.LayoutParams rootParams = new WindowManager.LayoutParams(-1, -2);
rootParams.gravity = Gravity.TOP;
root.setLayoutParams(rootParams);
LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.HORIZONTAL);
if (isSupport()) {
layout.setBackgroundResource(context.getResources().getIdentifier("colorAccent", "color", context.getPackageName()));
}
// layout.setBackgroundResource(android.R.color.holo_red_dark);
// layout.setVerticalGravity(Gravity.VERTICAL_GRAVITY_MASK);
final RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(-2, -2);
params.addRule(RelativeLayout.CENTER_IN_PARENT);
layout.setLayoutParams(params);
layout.setMinimumHeight(getMinHeight(context));
ImageView imageView = new ImageView(context);
imageView.setTag("image");
imageView.setVisibility(View.GONE);
TextView textView = new TextView(context);
textView.setTag("text");
textView.setTextColor(Color.WHITE);
final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
layoutParams.setMargins(getMinHeight(context, 10), 0, 0, 0);
layoutParams.gravity = Gravity.CENTER_VERTICAL;
layout.addView(imageView, layoutParams);
layout.addView(textView, layoutParams);
root.addView(layout);
return root;
}
示例3: getFooterView
import android.widget.LinearLayout; //导入方法依赖的package包/类
public View getFooterView() {
LinearLayout footerView = new LinearLayout(getContext());
footerView.setMinimumHeight(10);
return footerView;
}