2017-06-10 1 views
0

Ich bin Anfänger in Android und will zu diesem Zweck schreibe diesen XML-Code eine einfache Fußzeile meine Anwendung entwerfen:
Wie kann Image Button Höhe größer als RelativeLayout gesetzt werden?

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/footer" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:background="#125688" 
    android:gravity="center"> 
    <ImageButton 
     android:layout_width="45dp" 
     android:layout_height="45dp" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" 
     android:src="@drawable/left" 
     android:scaleType="fitCenter" 
     android:layout_alignParentLeft="true" 
     android:foregroundGravity="right"/> 
</RelativeLayout> 


alles in Ordnung ist, aber ich mag die Grafik-Taste ein wenig größer Show als relativ layout box oder footer, für mehr exmplain ich möchte bild taste höhe größer als layout, wie kann ich das lösen?
Ich möchte diese Ausgabe bitte, dass Sie unter: my Output

+0

zeigen einige Bilder oder skizzieren, was Sie –

+0

@PratikVyas Dank mein Freund die Aufmerksamkeit auf mein Problem wollen, ich kippe Bild posten, bitte warten andere Server zu finden um zu zeigen, that –

+0

@PratikVyas Bitte überprüfen Sie meine Post mein Freund, Bild in meinem Output-Link hochladen –

Antwort

0

Sie mögen dies tun können,

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    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"> 

    <RelativeLayout 
     android:id="@+id/bottom_layout" 
     android:layout_width="match_parent" 
     android:layout_height="150dp" 
     android:layout_alignParentBottom="true" 
     android:background="@color/colorPrimary"> 


    </RelativeLayout> 

    <ImageView 
     android:id="@+id/profile__iv" 
     android:layout_width="100dp" 
     android:layout_height="100dp" 
     android:layout_alignTop="@+id/bottom_layout" 
     android:layout_marginTop="-50dp" 
     android:background="@drawable/bg_circle"/> 

</RelativeLayout> 

ziehbar/bg_circle.xml

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
     android:shape="oval"> 

    <size 
     android:width="60dp" 
     android:height="60dp"/> 
    <solid android:color="@color/White"/> 

</shape> 
+0

Danke mein Freund, aber ich möchte nicht zeigen rote Bereich, klicken Sie bitte hier Link, um meinen Zweck zu sehen: https: //ibb.co/iSACYF –

+0

Sie können die relative Layout-Hintergrundfarbe des übergeordneten Elements entfernen. Ich gab nur um Unterschied zu zeigen –

+0

Ich habe meinen Code aktualisiert. –

0

Nicht Possible.Because Image ist Kind Relatives Layout Aber Use set sind beide gleich groß.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/footer" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:layout_alignParentBottom="true" 
android:background="#125688" 
android:gravity="center"> 
<ImageButton 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_centerVertical="true" 
    android:layout_centerHorizontal="true" 
    android:src="@drawable/left" 
    android:scaleType="fitCenter" 
    android:layout_alignParentLeft="true" 
    android:foregroundGravity="right"/> 
</RelativeLayout> 

oder der Nutzung dieser

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:orientation="vertical" 
android:background="#B0BEC5" 
tools:context="com.example.raj.jazzflurry.MainActivity"> 
<ImageButton 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:src="@drawable/ic_menu_camera" 
android:id="@+id/image"/> 
<RelativeLayout 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_marginTop="10dp" 
android:background="@color/cardview_dark_background" 
android:layout_alignParentBottom="true"> 
<TextView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="20dp" 
    android:textColor="#FFFFFF" 
    android:text="Hai" 
    android:textAlignment="center"/> 
</RelativeLayout> 
</RelativeLayout>