-2
TextView内のテキストのセンタリングに問題があります。テキストをTextviewの中央に配置します。ここに私のコードfは次のとおりです。 this そして、それは私が欲しいまさにだ:私は、Android Studioでプレビューを見てみるとTextviewのテキストの中央揃え
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#EAEAEA"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:weightSum="3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/Ciech"
android:src="@drawable/ciech"
android:layout_marginTop="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/border"
android:layout_margin="5dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="sampletext"
android:layout_margin="16dp"/>
</ScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/globus"
android:src="@drawable/grid_world"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="sampletext"
android:textColor="#000000"
android:textStyle="bold"
android:layout_alignBottom="@+id/globus"
android:layout_toEndOf="@+id/globus"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/globus"
android:gravity="center" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/koperta"
android:src="@drawable/close_envelope"
android:layout_below="@+id/globus"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="sampletext"
android:textColor="#000000"
android:textStyle="bold"
android:layout_alignBottom="@+id/koperta"
android:layout_alignTop="@+id/koperta"
android:layout_toRightOf="@+id/koperta"
android:gravity="center" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/torba"
android:src="@drawable/portfolio_black_tool"
android:layout_below="@+id/koperta"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="sampletext"
android:textColor="#000000"
android:textStyle="bold"
android:layout_alignBottom="@+id/torba"
android:layout_toEndOf="@+id/torba"
android:layout_alignTop="@+id/torba"
android:layout_toRightOf="@+id/torba"
android:gravity="center" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/znaczek"
android:src="@drawable/map_marker"
android:layout_below="@+id/torba"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="sampletext"
android:textColor="#000000"
android:textStyle="bold"
android:layout_alignBottom="@+id/znaczek"
android:layout_toEndOf="@+id/znaczek"
android:layout_alignTop="@+id/znaczek"
android:layout_toRightOf="@+id/znaczek"
android:gravity="center" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
それは私を示しています。私はエミュレータを実行したときしかし、それが急激に変化し、次のようになります。あなたが中心になりたいTextViewsへandroid:textAlignment="center"
:誰かがこの1で私を助けることができるthis
、私はバッフル付き
あなたは完全なxmlを投稿できますか? –
テキストビュープロパティを追加: 'android:layout_gravity = "center_vertical" ' – pRaNaY
android:layout_gravity =" center_vertical "は何も変更しません。私は完全なXMLを投稿しました –