我正在尝试垂直对齐生成的Facebook“分享”按钮和Twitter“推特”按钮,但我似乎无法做到这一点。我已经包含了一个代码段,但由于某种原因,Facebook按钮不会生成。您可以在我的网站here上查看该问题。
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.5";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<div class="socialMediaButtons" style="vertical-align:top;">
<div class="fb-share-button" data-href="https://www.atlasestateagents.co.uk/property-191/residential/for-sale/alexandra-drive-aigburth-l17" data-layout="button"></div>
<a href="https://twitter.com/share" class="twitter-share-button"{count} data-url="https://www.atlasestateagents.co.uk/property-191/residential/for-sale/alexandra-drive-aigburth-l17" data-related="atlasestates" data-hashtags="property">Tweet</a>
</div>
答案 0 :(得分:3)
除了使用public class CAdapter extends RecyclerView.Adapter<CAdapter.ViewHolder> {
List<CheckBoxItem> checkBoxItems;
Context context;
public static class ViewHolder extends RecyclerView.ViewHolder {
public TitleView checkBoxTitle;
public ImageView deleteCheckBox;
public CheckBox checkBoxCheckBox;
public ViewHolder(View itemView) {
super(itemView);
checkBoxTitle = (TitleView) itemView.findViewById(R.id.checkbox_item_text);
checkBoxCheckBox = (CheckBox) itemView.findViewById(R.id.checkbox_item_checkbox);
Log.d("CAdapterLog", "Adpater Holded !!!!! :( ");
deleteCheckBox = (ImageView) itemView.findViewById(R.id.btn_delete_checkbox);
}
}
public CAdapter(List<CheckBoxItem> checkBoxItems, Context context) {
this.checkBoxItems = checkBoxItems;
this.context = context;
Log.d("CAdapterLog", "Adpater Created !!!!! :( ");
}
@Override
public CAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.checkbox_item, parent, false);
ViewHolder vh = new ViewHolder(v);
Log.d("CAdapterLog", "Adpater ViewHolded :( !!!!! :( ");
return vh;
}
@Override
public void onBindViewHolder(CAdapter.ViewHolder holder, int position) {
Boolean isCheckboxChecked = Boolean.parseBoolean(checkBoxItems.get(position).getCheckBoxIsDone());
String checkBoxText = checkBoxItems.get(position).getCheckBoxBody();
Log.d("CAdapterLog", "Adpater Binded :( ");
final int checkboxID = Integer.parseInt(checkBoxItems.get(position).getCheckBoxID());
int reminderCheckBoxID = Integer.parseInt(checkBoxItems.get(position).getCheckBoxReminderID());
holder.deleteCheckBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d("CAdapterLog", "Cross Button Clicked !");
}
});
holder.checkBoxCheckBox.setChecked(isCheckboxChecked);
holder.checkBoxTitle.setText(checkBoxText);
}
@Override
public int getItemCount() {
return checkBoxItems.size();
}
}
属性移动Facebook按钮之外,还可以使用vertical-align:middle
。
top