我有一张卡,想要添加内容.我应该如何在卡片中添加图片和文字?这是我的xml代码:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="ml.vedantk.app.god.MainActivity">
<android.support.v7.widget.CardView
android:id="@+id/card1"
android:layout_width="364dp"
android:layout_height="389dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="64dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
这是java文件:
package ml.vedantk.app.god;
import android.support.annotation.ColorInt;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.CardView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
CardView card1 = (CardView)findViewById(R.id.card1);
card1.setCardBackgroundColor(100);
}
}
Run Code Online (Sandbox Code Playgroud)
在card1.setCardBackgroundColor(100);还没有改变背景颜色.那么有人可以帮我添加图像吗?
该for循环递增变量,并继续,直到条件为假以运行该组在其报表.这是for循环的正确替代方案吗?
abc : i++;
if(i<=10)
{
goto abc;
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,
这是一个正确的选择吗?如果没有,for循环实际上如何工作?