Android LoginButton Facebook no action size height

I have use button facebook, but when set size height, it is no success. Can you help me. It my code :

<com.facebook.login.widget.LoginButton android:id="@+id/btn_login_facebook" android:layout_width="match_parent" android:layout_height="50dp" android:layout_gravity="center_horizontal" android:layout_marginBottom="10dp" android:layout_marginTop="20sp"/>


You can setPadding for your facebook Like box.


package com.example.facebook;

import com.example.facebook.FacebookLinkStatProcessor.Result;
import com.example.fblike.R;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.Button;

public class FacebookLikeBox extends Button {
private static final String LOG_TAG = FacebookLikeBox.class.getSimpleName();
private static final Looper BACKGROUND;

static {
HandlerThread thread = new HandlerThread(FacebookLikeBox.class.getSimpleName(), Process.THREAD_PRIORITY_LOWEST);
BACKGROUND = thread.getLooper();

private Handler mHandler;
private FacebookLinkStatProcessor mProcessor;
private String mUrl;
private boolean mAttachedToWindow;

private CalloutPath mPath;
private ShapeDrawable mFill;
private ShapeDrawable mStroke;
private float mCornerRadius;
private int mCalloutMarker;

public void setProcessor(FacebookLinkStatProcessor processor) {
mProcessor = processor;

public void setPageUrl(String url) {
String old = mUrl;
mUrl = url;

if (old == null && url != null || old != null && !old.equals(url)) {
onUrlChanged(old, url);

public boolean isAttachedToWindow() {
return mAttachedToWindow;
} else {
return super.isAttachedToWindow();

public FacebookLikeBox(Context context) {

public FacebookLikeBox(Context context, AttributeSet attrs) {
super(context, attrs);

public FacebookLikeBox(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);

private void init(AttributeSet attrs) {
mProcessor = new FacebookLinkStatProcessor();

mHandler = new Handler(BACKGROUND, new Handler.Callback() {
public boolean handleMessage(Message msg) {
processUrl((String) msg.obj);
return true;

if (attrs == null) {

Context c = getContext();
if (c == null) {

TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.FacebookLikeBox);
if (a == null) {

Resources r = getResources();
if (r == null) {

try {
mPath = new CalloutPath();
mFill = new ShapeDrawable();
mFill.getPaint().setColor(a.getColor(R.styleable.FacebookLikeBox_boxFillColor, r.getColor(R.color.com_shamanland_facebook_like_box_background_color)));
mStroke = new ShapeDrawable();
mStroke.getPaint().setColor(a.getColor(R.styleable.FacebookLikeBox_boxStrokeColor, r.getColor(R.color.com_shamanland_facebook_like_box_text_color)));
mStroke.getPaint().setStrokeWidth(a.getDimension(R.styleable.FacebookLikeBox_boxStrokeWidth, r.getDimension(R.dimen.com_shamanland_facebook_like_box_stroke_width)));
mCornerRadius = a.getDimension(R.styleable.FacebookLikeBox_boxCornersRadius, r.getDimension(R.dimen.com_shamanland_facebook_like_corners_radius));
mCalloutMarker = a.getInt(R.styleable.FacebookLikeBox_calloutMarker, 0);

} finally {

private void initBackground() {

Drawable drawable = new LayerDrawable(new Drawable[]{mFill, mStroke});
} else {

setPadding(5, 5, 5, 5); // you can do your padding.

protected void onAttachedToWindow() {
mAttachedToWindow = true;

protected void onDetachedFromWindow() {
mAttachedToWindow = false;

protected void onSizeChanged(int w, int h, int oldW, int oldH) {, w, h, mStroke.getPaint().getStrokeWidth(), mCornerRadius);
PathShape shape = new PathShape(mPath, w, h);

protected void onUrlChanged(String oldValue, String newValue) {

if (oldValue != null) {
mHandler.removeMessages(0, oldValue);

if (newValue != null) {
Message msg = Message.obtain();
if (msg != null) {
msg.obj = newValue;

* Background thread
protected void processUrl(final String url) {
try {
final Result result = mProcessor.processUrl(url);
post(new Runnable() {
public void run() {
if (isAttachedToWindow()) {
postProcessUrl(url, result);
} catch (Throwable ex) {
/*if (LOGGING) {, ex);

protected void postProcessUrl(String url, Result result) {
if (url.equals(mUrl)) {

protected void onUrlProcessed(Result result) {

protected String prettyNumber(long number) {
if (number > 1000000000L) {
return number / 1000000000L + "." + (number % 1000000000L) / 100000000L + "b";
} else if (number > 1000000L) {
return number / 1000000L + "." + (number % 1000000L) / 100000L + "m";
} else if (number > 1000L) {
return number / 1000L + "." + (number % 1000L) / 100L + "k";
} else {
return String.valueOf(number);

Category:android Time:2018-12-28 Views:4

Related post

  • How to make android EditText smaller than default in height? 2009-09-01

    How to make android EditText smaller than default in height? If I change the height, I can't see my text, but it has extra blank on bottom. --------------Solutions------------- EditText has a default padding set. Try this, <EditText android:text="

  • Android: Changing the camera preview size on screen 2011-08-10

    Currently, the Camera Preview is stretched to fit the entire screen (854x480). I'd like it to display (427x240) instead. Here is the relevant code for the camera implementation: Camera.Parameters params = camera.getParameters(); params.setPreviewSize

  • Android gridview adjusting to screen size 2012-01-02

    The grid view of my application has 3 rows and 3 columns. I want this to fill the screen ,irrespective of the screen size of the device. I tried getting window size and setting the layoutparams accordingly. But this is not giving a perfect alignment

  • Get back original size (height, width) from UIImage load with imageWithData 2010-04-25

    I just cant find useful information from web. I have an UIImage which loaded from sqlLite with method imageWithData(NSData*), I just find the height and width of the size both be zero. I wanna get back the original height and width of the image, is i

  • Set UIView.frame.size.height to zero to hide content? 2010-07-20

    UIView *stateView = [getSomeUIView thisOne]; CGRect currentFrame = stateView.frame; if(currentFrame.size.height == 0.0) { currentFrame.size = CGSizeMake(260, 60); } else { currentFrame.size = CGSizeMake(260, 0); } stateView.frame = currentFrame; I wo

  • View Frame Size Height = 0 2010-09-10

    I`m getting 0 when I return this from my ViewController : NSLog(@"%i",self.view.frame.size.height); In Interface builder, the View it's managing is occupying the entire screen . Help ? --------------Solutions------------- Height is a float. Use %f to

  • view.frame.size.height changing in UIViewController 2010-09-20

    Inside my view, I have a table and an ad banner, all of which are created through Interface Builder. But I noticed that my view.frame.size.height seems to change through the course of execution of my app even though I haven't changed the size. Can so

  • Android - Native Facebook app causing invalid_key error? 2011-04-30

    I'm working on implanting Facebook in my app. Now I didn't put the Hash Key because I don't want the Single Sign On feature. I managed to get it it work, but if I have the native Facebook app on my device I get an 'invalid_key error'. If I uninstall

  • Detect div size (height) while filling content (from database) 2011-06-03

    I want to detect the div size height while filling content (from database). If the div height exeed 800px, then draw new div as new content wrapper and fill the remain content inside. The illustration is like the following : Single content wrapper pr

  • Getting size, height and width of an image? 2011-07-23

    How can I get the size, height and width of an image in when upload it with jQuery? --------------Solutions------------- if you use jquery uploadify plugin then you can find the file size by any one of these following method 'onSelect': function(even

  • Why is self.bounds.size.height not taking into account the UINavigationView nav bar in this code? 2011-08-03

    I have a configuration UITableView that can launch a colour picker via a UINavigationController approach: [self.navigationController pushViewController:colorPickerViewController animated:YES]; [colorPickerViewController release]; The effect of this m

  • CoreText flip coordinates self.bounds.size.height error bounds 2011-08-28

    I am drawing text in the view with CoreText. To learn this I used a tutorial, but suddenly it uses self.bounds.size.height, in a part where it flips the coordinate system. When I was duplicating the code in Xcode it gave an error because 'bounds' was

  • Is there a way to declare background-size-height? 2011-12-11

    Is there a way to declare background-size-height, or something close to that? I want the background image to fit 100% height but keep it's proportions, aka width still dynamic. Thanks for any pointers. --------------Solutions------------- See this ar

  • the frame.origin.y change on when I change UIVIew's bounds.size.height 2011-12-23

    (my english is not very well LOL) i defined a UIView object as a subview, when i change the subview.bounds.size.height, the subview.frame.origin.y changed, is there something wrong in my code? here is my code: - (IBAction)touch { static int i = 1; NS

  • The container 'Android Dependencies' references non existing library 'facebook-android-sdk\facebook\bin\com_facebook_android.jar' 2012-04-20

    I am trying to use the facebook sdk within my project, however keep receiving the following error: The container 'Android Dependencies' references non existing library 'facebook-android-sdk\facebook\bin\com_facebook_android.jar' Has anyone experience

  • android: how to change Text size, color of Options Menu Items and options menu height and width 2011-02-22

    I have used the following code to customize the background of options menu successfully. getLayoutInflater().setFactory(new Factory() { @Override public View onCreateView(String name, Context context, AttributeSet attrs) { if (name.equalsIgnoreCase("

  • Android contextmenu item size / height, how to change? 2011-06-25

    How can i change the contextmenu item's size? height? Thanks, Leslie --------------Solutions------------- It's not really intended to be modified - it's there to handle menu in standard way. There are some ways to modify the menu and its items (for e

  • Android: How to change CheckBox size? 2010-01-27

    I would like to make CheckBox a bit smaller/bigger, how can I do this? --------------Solutions------------- You just need to set the related drawables and set them in the checkbox: <CheckBox android:layout_width="wrap_content" android:layout_heigh

  • Android: How to change the Size of the RadioButton 2010-06-10

    I have many RadioButtons in mein App. The RadioButtons are too big for me. Is there any way to make it smaller? --------------Solutions------------- Can't be done, the radio button is a built-in control component and as such its size is fixed. It can

  • Android how to sniff screen size from webkit browser? 2010-11-08

    The webserver wants to get info like screen size from each mobile handset that browses a webpage. The Javascript functions screen.width and screen.height return wildly inaccurate values. Is there a way for the webserver to detect the screen size of t

Copyright (C), All Rights Reserved.

processed in 0.311 (s). 13 q(s)