Ich möchte dies zu schaffen, und ich habe ziehbar in ihnen zusammen mit Textview verwendet:Android: Wie Textview sichtbar mit Polsterung machen
Aber ich bin nicht die Textview in der Mitte immer noch ganzer Text ist sichtbar aufgrund der Polsterung. Wie ändere ich meinen vorhandenen Code so, dass er so aussieht? Momentan möchte ich nicht das Bild und nur den Text und die Tasten.
rounded_edge.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<solid android:color="#FFFFFF"/>
<stroke android:width="5dp"
android:color="#000000"/>
<!--<padding android:left="30dp"
android:top="350dp"
android:right="250dp"
android:bottom="10dp"/>-->
<gradient android:startColor="#D2E0E2" android:endColor="#D2E0E2"/>
<corners android:bottomRightRadius="5dp" android:bottomLeftRadius="5dp"
android:topLeftRadius="5dp" android:topRightRadius="5dp"/>
</shape>
yelp_biz_detail.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_centerInParent="true"
>
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/rounded_edge"
android:layout_marginTop="30dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:paddingLeft="30dp"
android:paddingTop="350dp"
android:paddingRight="250dp"
android:paddingBottom="10dp"/>
android:textAlignment="center"
android:gravity="center"
/>
</LinearLayout>
Lösung ist:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_centerInParent="true"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_marginTop="30dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="150dp"
android:background="@drawable/rounded_edge"
>
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="30dp"
android:paddingTop="30dp"
android:paddingRight="25dp"
android:paddingBottom="10dp"
android:textAllCaps="true"
/>
</LinearLayout>
</LinearLayout>
Ich könnte dieses Problem lösen, indem eine lineare Layout in einer anderen linearen Layout zugab und das Problem gelöst. – Nick
Könnten Sie bitte unten antworten und es als akzeptiert markieren, anstatt die Frage zu bearbeiten? Vielen Dank? –