我怎么能把我放在fab我的片段上?请帮忙,我得到的错误,如.
android.view.InflateException:二进制XML文件行#13:错误膨胀类片段
在我的片段中.那么这是我的代码.
那问题就在于 getActivity().setContentView(R.layout.activity_ownerhome);
#ownerhome.java
public class ownerhome extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ownerhome);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
}
Run Code Online (Sandbox Code Playgroud)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_owner, container, false);
ImageLoader.getInstance().init(UILConfig.config(getActivity()));
lvCars = (ListView) v.findViewById(R.id.lvOnwer);
pref = getActivity().getSharedPreferences("Login.conf", Context.MODE_PRIVATE);
Log.d(TAG, pref.getString("username", ""));
Log.d(TAG, pref.getString("password", ""));
PostResponseAsyncTask taskRead = new PostResponseAsyncTask(getActivity(), this);
tvUser = (TextView) v.findViewById(R.id.tvUser);
tvUser.setText("Hello! "+pref.getString("username", ""));
taskRead.execute("http://carkila.esy.es/user.php?owner="+pref.getString("username", ""));
FloatingActionButton fab = …Run Code Online (Sandbox Code Playgroud) 我正在使用 FPDF 库作为 PDF 文档生成器来生成表格。
问题是包含数据的表格不会居中,尽管我尝试在 $pdf->Cell() 参数中写入“C”。输出与左侧对齐,如下所示。
还有为什么当我添加新列(第 5 列)时,单元格移到底部,而右侧仍然有空格,如下所示。
我尝试在所有相关单元格内添加“C”参数,如下所示
$pdf->Cell(190,7,'Some text',0,1,'C');,
还使用了这篇文章$pdf->SetXY(20,20);中的解决方案
,但它仍然不起作用。
我当前的代码是:
<?php
require('fpdf.php');
$pdf = new FPDF('P','mm','A4');
$pdf->AddPage();
$pdf->Image('some_image.png',10,10,30,15);
$pdf->SetFont('Arial','B',16);
$pdf->Cell(190,7,'Some title',0,1,'C');
$pdf->SetFont('Arial','B',9);
$pdf->Cell(190,7,'Jl. Some address',0,1,'C');
$pdf->Cell(10,7,'',0,1);
$pdf->SetFont('Arial','B',9);
$pdf->Cell(190,7, $somestring1 ,0,1,'C');
$pdf->SetFont('Arial','',9);
$pdf->Cell(190,7,'to',0,1,'C');
$pdf->SetFont('Arial','B',9);
$pdf->Cell(190,7, $somestring2 ,0,1,'C');
$pdf->SetFont('Arial','B',8);
$pdf->Cell(10,7,'',0,1,'C');
$pdf->Cell(6,6,'NO',1,0,'C');
$pdf->Cell(23,6,'TUJUAN',1,0,'C');
$pdf->Cell(25,6,'PEMINJAM',1,0,'C');
$pdf->Cell(35,6,'KENDARAAN',1,0,'C');
$pdf->Cell(27,6,'JAM BERANGKAT',1,1,'C');
// If I add this cell, then i'll overlap/move to the bottom
$pdf->Cell(27,6,'JAM PULANG',1,1,'C');
$pdf->SetFont('Arial','',8);
$query = mysqli_query($someconn, "SELECT somequery");
$i = 1;
while …Run Code Online (Sandbox Code Playgroud)