Java Code Examples for android.widget.ScrollView#setFadingEdgeLength()

The following examples show how to use android.widget.ScrollView#setFadingEdgeLength() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UIActionSheetDialog.java    From Auie with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 构建内容视图 - IOS
 * @return 内容视图
 */
@SuppressWarnings("deprecation")
private View createContentViewForIOS(){
	//根布局
	rootLayout = new LinearLayout(context);
	rootLayout.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
	rootLayout.setOrientation(LinearLayout.VERTICAL);
	rootLayout.setBackgroundColor(Color.parseColor("#77000000"));
	rootLayout.setGravity(Gravity.BOTTOM);
	
	parentLayout = new LinearLayout(context);
	parentLayout.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	parentLayout.setOrientation(LinearLayout.VERTICAL);
	parentLayout.setBackgroundColor(Color.parseColor("#00000000"));
	
	LinearLayout childLayout = new LinearLayout(context);
	LayoutParams childParams = getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	childParams.setMargins(8 * DP, 0, 8 * DP, 0);
	childLayout.setLayoutParams(childParams);
	childLayout.setOrientation(LinearLayout.VERTICAL);
	childLayout.setBackgroundDrawable(UEImage.createBackground(Color.WHITE, 204, 10));
	
	//标题
	TextView titleTextView = new TextView(context);
	titleTextView.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	titleTextView.setPadding(0, 10 * DP, 0, 10 * DP);
	titleTextView.setMinHeight(45 * DP);
	titleTextView.setTextSize(14);
	titleTextView.setGravity(Gravity.CENTER);
	titleTextView.setTextColor(Color.parseColor("#8F8F8F"));
	if (title == null) {
		titleTextView.setVisibility(View.GONE);
	}else{
		titleTextView.setVisibility(View.VISIBLE);
		titleTextView.setText(title);
	}
	
	//内容外层布局
	sheetLayout = new ScrollView(context);
	sheetLayout.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	sheetLayout.setFadingEdgeLength(0);
	
	//内容内层布局
	contentLayout = new LinearLayout(context);
	contentLayout.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	contentLayout.setOrientation(LinearLayout.VERTICAL);
	sheetLayout.addView(contentLayout);
	
	//取消按钮
	final TextView cancelTextView = new TextView(context);
	LayoutParams params = getParams(LayoutParams.MATCH_PARENT, 45 * DP);
	params.setMargins(8 * DP, 8 * DP, 8 * DP, 8 * DP);
	cancelTextView.setLayoutParams(params);
	cancelTextView.setTextColor(Color.parseColor("#3DB399"));
	cancelTextView.setTextSize(16);
	cancelTextView.setGravity(Gravity.CENTER);
	cancelTextView.setText("取消");
	cancelTextView.setBackgroundDrawable(UEImage.createBackground(Color.WHITE, 204, 10));
	cancelTextView.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View arg0) {
			dismiss();
		}
	});
	
	//控件创建结束
	childLayout.addView(titleTextView);
	childLayout.addView(sheetLayout);
	parentLayout.addView(childLayout);
	parentLayout.addView(cancelTextView);
	rootLayout.addView(parentLayout);
	if (typeface != null) {
		titleTextView.setTypeface(typeface);
		cancelTextView.setTypeface(typeface);
	}
	return rootLayout;
}
 
Example 2
Source File: UIActionSheetDialog.java    From Auie with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 构建内容视图 - ANDROID
 * @return 内容视图
 */
private View createContentViewForANDROID(){
	//根布局
	rootLayout = new LinearLayout(context);
	rootLayout.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
	rootLayout.setOrientation(LinearLayout.VERTICAL);
	rootLayout.setBackgroundColor(Color.parseColor("#55000000"));
	rootLayout.setGravity(Gravity.BOTTOM);
	
	parentLayout = new LinearLayout(context);
	parentLayout.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	parentLayout.setOrientation(LinearLayout.VERTICAL);
	parentLayout.setBackgroundColor(backgroundColor);
	
	LinearLayout childLayout = new LinearLayout(context);
	LayoutParams childParams = getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	childLayout.setLayoutParams(childParams);
	childLayout.setOrientation(LinearLayout.VERTICAL);
	
	//标题
	TextView titleTextView = new TextView(context);
	titleTextView.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	titleTextView.setMinHeight(48 * DP);
	titleTextView.setTextSize(12);
	titleTextView.setGravity(Gravity.CENTER);
	titleTextView.setTextColor(titleColor);
	if (title == null) {
		titleTextView.setVisibility(View.GONE);
	}else{
		titleTextView.setVisibility(View.VISIBLE);
		titleTextView.setText(title);
	}
	
	//内容外层布局
	sheetLayout = new ScrollView(context);
	sheetLayout.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	sheetLayout.setFadingEdgeLength(0);
	
	//内容内层布局
	contentLayout = new LinearLayout(context);
	contentLayout.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	contentLayout.setOrientation(LinearLayout.VERTICAL);
	sheetLayout.addView(contentLayout);
	
	//取消按钮
	final TextView cancelTextView = new TextView(context);
	LayoutParams params = getParams(LayoutParams.MATCH_PARENT, 52 * DP);
	params.setMargins(0, 8 * DP, 0, 0);
	cancelTextView.setLayoutParams(params);
	cancelTextView.setTextColor(cancelColor);
	cancelTextView.setTextSize(16);
	cancelTextView.setGravity(Gravity.CENTER);
	cancelTextView.setText("取消");
	cancelTextView.setBackgroundColor(itemBackgroundColor);
	cancelTextView.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View arg0) {
			dismiss();
		}
	});
	
	//控件创建结束
	childLayout.addView(titleTextView);
	childLayout.addView(sheetLayout);
	parentLayout.addView(childLayout);
	parentLayout.addView(cancelTextView);
	rootLayout.addView(parentLayout);
	if (typeface != null) {
		titleTextView.setTypeface(typeface);
		cancelTextView.setTypeface(typeface);
	}
	return rootLayout;
}