Friday, January 8, 2016

Inclusione di un LinearLayout su xml esterno nel LinearLayout dell'activity principale, mediante xml. #JHedzWorlD

Ecco come ho creato un LinearLayout contenente tre LinearLayout, di cui uno esterno incluso, il tutto tramite manipolazione dell’xml.

activity_main.xml



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context="com.example.lab10.MainActivity" >

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/w" >
</LinearLayout>

<include layout="@layout/hills"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />


<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/w3" >
</LinearLayout>
</LinearLayout>

la parte marcata in giallo è l’inclusione dell’xml esterno.

hills.xml (xml esterno)



<?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:background="@drawable/hills"
android:orientation="vertical" >
</LinearLayout>

…e il risultato è perfetto!




This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.


JHedzWorlD


AIM GLOBAL






No comments:

Post a Comment