我想在我使用此代码部分时,根据宽度大小将图像(URL)显示为我的imageview中的最大宽度和可变高度:
imageView = (ImageView) convertView.findViewById(R.id.imageView);
Picasso.with(context).load(product.getImage()).into(imageView);
Run Code Online (Sandbox Code Playgroud)
我可以将我的图像显示到imageview中.我也试过使用resize().centerCrop()方法并且它成功运行.
但是,当我使用时
Picasso.with(上下文).load(product.getImage())拟合()centerCrop()代入(ImageView的).;
要么
Picasso.with(上下文).load(product.getImage())拟合()centerInside()代入(ImageView的).;
我的imageview什么都没显示.我不明白为什么.也许问题是我的列表设计和imageview.这是我的list_content_item.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.80"
app:srcCompat="@mipmap/ic_launcher" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="1"
android:layout_weight="0.2"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_weight="0.3"
android:layout_height="match_parent" />
<TextView
android:id="@+id/tv_stats"
android:layout_weight="0.7"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"/>
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我尝试了将 ImageView的宽度和高度设置为wrap_content和match_parent,但它也没有用.我在哪里错过了?提前致谢.
我正在努力将 PDF 转换为文本。我可以正确地从 PDF 中获取文本,但它的表结构很复杂。我知道 PDF 不支持表格结构,但我认为有一种方法可以正确获取单元格。嗯,例如:
我想转换成这样的文本:
> This is first example.
> This is second example.
Run Code Online (Sandbox Code Playgroud)
但是,当我将 PDF 转换为文本时,这些数据如下所示:
> This is This is
> first example. second example.
Run Code Online (Sandbox Code Playgroud)
如何才能正确获取值?
- 编辑:
以下是我如何将 PDF 转换为文本:
OpenFileDialog ofd = new OpenFileDialog();
string filepath;
ofd.Filter = "PDF Files(*.PDF)|*.PDF|All Files(*.*)|*.*";
if (ofd.ShowDialog() == DialogResult.OK)
{
filepath = ofd.FileName.ToString();
string strText = string.Empty;
try
{
PdfReader reader = new PdfReader(filepath);
for (int page = 1; page < reader.NumberOfPages; page++)
{
ITextExtractionStrategy its …Run Code Online (Sandbox Code Playgroud) 当用户将文本框留空时,我真的无法添加显示消息的条件.我已经尝试了所有我知道的方法来更改它但它根本不起作用.我有"5"文本框并隐藏和显示它们基于选定的组合框项目值,例如,如果我选择枪支它应该全部五个文本框,如果我选择弹药然后它应该只显示三个文本框(1,2和3).它应该显示消息框警告我,如果我离开单个文本框空白.
但问题是在弹药设置期间,即使我填写了所有的文本字段,消息框仍然显示出来.我的if else语句是否有问题?
private void insertbtn_Click(object sender, EventArgs e)
{
string mysql = "";
if (comboBox1.SelectedItem.ToString() == "Firearm")
{
mysql = "insert into Firearm(Fid,Fname,Ftype,Manufacturer,Price) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "')";
}
if (comboBox1.SelectedItem.ToString() == "Ammo")
{
mysql = "insert into Ammo(Aid,Atype,Coating,Metal) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')";
}
if (comboBox1.SelectedItem.ToString() == "Ammo" && textBox1.Text …Run Code Online (Sandbox Code Playgroud)