よりも低いこの1は、この中にゼリービーンで撮影された画像が示され、メニュー内のテキストがされていないデバイスで適切に動作していませんCardviewこのスクリーンショットは、マシュマロ</p> <p><a href="https://i.stack.imgur.com/wSvX4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wSvX4.jpg" alt="enter image description here"></a></p> <p>に取り込まれるロリポップ
見えない私は、親ビューとしてCardviewとレイアウトを持っています。
イメージとテキストで構成されています。
: は今のレイアウトは、画像がproperly.Theyが小さいオンにし、完全にここだ私のレイアウトXMLファイルをカードビューに一致していません示されていないAndroidのMとし、上記のデバイス上ではなく、(Jellybeanのような)下のバージョンで正常に動作します
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
app:cardPreventCornerOverlap="false"
android:elevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<android.support.v7.widget.CardView
android:layout_width="80dp"
android:layout_height="80dp">
<ImageView
android:id="@+id/home_news_image"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center_vertical"
android:scaleType="centerCrop"
android:src="@drawable/jesus" />
</android.support.v7.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/home_title_parish_news"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:paddingLeft="1dp"
android:text="Christmas Celebration"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:id="@+id/home_short_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:padding="3dp"
android:text="hi this is to tell thlkdsa asdsag slk sg sdg sdgjs gsd gsg jglsgja gasjggjasg asgjasgj sgjasg g g"
android:textSize="12dp" />
<TextView
android:id="@+id/home_date_published"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:gravity="right|bottom"
android:padding="3dp"
android:text="10/10/2010"
android:textSize="8dp" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
これは、私は、テキストが表示されていない画像の下にテキストを配置する場合、私はまた私のレイアウトとビュー
public class MenuAdapter extends BaseAdapter {
Context mContext;
ArrayList<MenuModel> list;
String img;
public MenuAdapter(Context c, ArrayList<MenuModel> list) {
mContext = c;
this.list = list;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int i) {
return i;
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
View grid;
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (view == null) {
grid = inflater.inflate(R.layout.home_grid_menu, null);
TextView textView = (TextView) grid.findViewById(R.id.home_grid_text);
ImageView imageView = (ImageView) grid.findViewById(R.id.home_grid_image);
textView.setText(list.get(i).getMenuName());
imageView.setImageResource(list.get(i).getMenuImage());
} else {
grid = (View) view;
}
return grid;
}
}
を初期化するアダプタです。
どうか私に教えてください。私は今、私はいくつかの解決策
を使用してテキストを共有することができ、両方の画像を添付してください。 –
framelayoutでcardviewをラップしてみてください(線形とカードビューの間に追加してください)。 – Jimmy
レイアウトを初期化するコードはどこですか? DeKaNszn @ – DeKaNszn