저는 android app 개발에 새로운입니다. 전 폭의 이미지를 설정하고 싶지만 너무 많은 공간을 차지하는 앱을 개발 중입니다. 나는 왜 그렇게 많은 공간을 차지하고 있는지 이해하지 못하고 있습니까? 이미지 URL (full.jpg)이미지가 CardView 내부의 ImageView에서 올바르게 설정되지 않았습니다.
내 XML 코드는 ImageView
에
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context="litifer.awesome.game.cardview.MainActivity"
>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/cardView1"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:cardCornerRadius="5dp"
app:cardElevation="0dp"
android:clickable="true"
app:cardBackgroundColor="@android:color/transparent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/cardView1Text"
android:text="Notifications"
android:textSize="20dp"
android:paddingTop="10dp"
android:paddingLeft="10dp"
android:paddingRight="40dp"
android:textStyle="bold"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/cardView1Text1"
android:text="we will let you know about great content when big news happens or when your magazines arrive"
android:layout_marginTop="10dp"
android:paddingLeft="10dp"
android:paddingRight="40dp"
android:textStyle="bold"
android:paddingBottom="30dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/cardView1Text2"
android:text="SETTINGS GOT IT"
android:paddingLeft="160dp"
android:textColor="#f2f"
android:clickable="true"
android:textStyle="bold"
android:paddingBottom="20dp"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingLeft="10dp"
android:text="HIGHLIGHTS"
android:textSize="20dp"
android:id="@+id/text"
android:textStyle="bold"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/text1"
android:text="Recommended based on your interests"
android:paddingLeft="10dp"
android:paddingTop="2dp"
android:textStyle="bold"
/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/cardView2"
android:layout_marginTop="10dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/image"
android:src="@drawable/full"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout></ScrollView>
즐거움과 함께. 원하는 경우 답변을 허용 된 것으로 표시 할 수 있습니다. –
android : adjustViewBounds = "true"를 적용한 경우 android : layout_gravity = "center"제대로 작동 함 –