Available Methods
- LayoutParams ( )
- addView ( )
- setLayoutParams ( )
- setId ( )
- findViewById ( )
- setOnClickListener ( )
- setBackgroundColor ( )
- setVisibility ( )
- getChildAt ( )
- removeView ( )
- removeAllViews ( )
- setPadding ( )
- getLayoutParams ( )
- setForeground ( )
- setWillNotDraw ( )
- getChildCount ( )
- setBackgroundResource ( )
- setBackground ( )
- setBackgroundDrawable ( )
- setClipChildren ( )
- setFocusableInTouchMode ( )
- setOnTouchListener ( )
- setTag ( )
- setOnApplyWindowInsetsListener ( )
- getSystemUiVisibility ( )
- setForegroundGravity ( )
- setRight ( )
- getRight ( )
- setOnLongClickListener ( )
- setFocusable ( )
- removeViewAt ( )
- getHeight ( )
- setOnDragListener ( )
- setScaleX ( )
- MarginLayoutParams ( )
- setEnabled ( )
- getContext ( )
- setClickable ( )
- setSystemUiVisibility ( )
- getLeft ( )
- setY ( )
- setTop ( )
Related Classes
- android.os.Bundle
- android.content.Context
- android.view.View
- android.util.Log
- android.widget.TextView
- android.content.Intent
- android.view.ViewGroup
- android.app.Activity
- android.view.LayoutInflater
- android.os.Build
- android.widget.Toast
- android.util.AttributeSet
- android.widget.ImageView
- android.graphics.Color
- android.net.Uri
- android.graphics.Canvas
- android.widget.Button
- android.text.TextUtils
- android.view.MotionEvent
- android.graphics.drawable.Drawable
- android.widget.LinearLayout
- android.content.res.TypedArray
- android.support.annotation.Nullable
- android.widget.EditText
- android.support.annotation.NonNull
Java Code Examples for android.widget.FrameLayout#setOnDragListener()
The following examples show how to use
android.widget.FrameLayout#setOnDragListener() .
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: RemoteControlView.java From RemoteControlView with Apache License 2.0 | 6 votes |
private void init(Context context) { setWillNotDraw(false); mPhonePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mBackPath = new Path(); // 不使用硬件加速,否则虚线显示不出 setLayerType(LAYER_TYPE_SOFTWARE, null); // 拖拽有效区域 frameLayout = new FrameLayout(context); frameLayout.setBackgroundColor(Color.parseColor(CONTENT_COLOR)); frameLayout.setOnDragListener(this); addView(frameLayout); // 提示文字 mTextView = new TextView(context); mTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); mTextView.setTextColor(Color.WHITE); mTextView.setText("长按并拖拽下方按钮到这里"); LayoutParams fl = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); fl.gravity = Gravity.CENTER; mTextView.setLayoutParams(fl); mTextView.measure(0, 0); addView(mTextView); }
Example 2
Source File: MainActivity.java From user-interface-samples with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView dragText = findViewById(R.id.text_drag); FrameLayout targetFrame = findViewById(R.id.frame_target); //Set up drop target listener. targetFrame.setOnDragListener(new DropTargetListener(this)); //Set up draggable item listener. dragText.setOnLongClickListener(new TextViewLongClickListener()); }