LikeView
有此級別的更新版本。前往查看 最新版本。

This class provides the UI for displaying the Facebook Like button and its associated components.

延伸:FrameLayout
套件:widget
建構函式
LikeView(Context)

Constructor

public LikeView(Context context)
參數說明
contextContext for this View
LikeView(Context, AttributeSet)

Constructor

public LikeView(Context context, AttributeSet attrs)
參數說明
contextContext for this View
attrsAttributeSet for this View.
類別方式
handleOnActivityResult(Context, int, int, Intent)

If your app does not use UiLifeCycleHelper, then you must call this method in the calling activity's onActivityResult method, to process any pending like actions, where tapping the button had resulted in the Like dialog being shown in the Facebook application.

public static boolean handleOnActivityResult(Context context, int requestCode, int resultCode, Intent data)
參數說明
contextHosting context
requestCodeFrom the originating call to onActivityResult
resultCodeFrom the originating call to onActivityResult
dataFrom the originating call to onActivityResult
Returns
Indication of whether the Intent was handled
執行個體方法
setObjectId(String)

Sets the associated object for this LikeView. Can be changed during runtime.

public void setObjectId(String objectId)
參數說明
objectIdObject Id
setLikeViewStyle(Style)

Sets the facebook:style for this LikeView. Can be changed during runtime.

public void setLikeViewStyle(Style likeViewStyle)
參數說明
likeViewStyleShould be either LikeView.STANDARD, LikeView.BUTTON or LikeView.BOX_COUNT
setAuxiliaryViewPosition(AuxiliaryViewPosition)

Sets the facebook:auxiliary_view_position for this LikeView. Can be changed during runtime.

public void setAuxiliaryViewPosition(AuxiliaryViewPosition auxiliaryViewPosition)
參數說明
auxiliaryViewPositionShould be either LikeView.TOP, LikeView.INLINE or LikeView.BOTTOM
setHorizontalAlignment(HorizontalAlignment)

Sets the facebook:horizontal_alignment for this LikeView. Can be changed during runtime.

public void setHorizontalAlignment(HorizontalAlignment horizontalAlignment)
參數說明
horizontalAlignmentShould be either LikeView.LEFT, LikeView.CENTER or LikeView.RIGHT
setForegroundColor(int)

Sets the facebook:foreground_color for this LikeView. Can be changed during runtime. The color is only used for the social sentence text.

public void setForegroundColor(int foregroundColor)
參數說明
foregroundColorAnd valid android.graphics.Color value.
setFragment(Fragment)

Sets the parent Fragment which is hosting this LikeView. This allows the LikeView to be embedded inside a Fragment, and will allow the fragment to receive the onActivityResult.onActivityResult(int, int, android.content.Intent) call rather than the Activity, upon completion of Likes from this view.

public void setFragment(Fragment fragment)
參數說明
fragmentFragment that is hosting the LikeView.
setOnErrorListener(OnErrorListener)

Sets an OnErrorListener for this instance of LikeView to call into when certain exceptions occur.

public void setOnErrorListener(OnErrorListener onErrorListener)
參數說明
onErrorListenerThe listener object to set
getOnErrorListener()

Returns the current OnErrorListener for this instance of LikeView.

public OnErrorListener getOnErrorListener()
Returns
The OnErrorListener