إعلان الصفحة الرئيسية

الجمعة، 26 مارس 2021

تعديل واجهة الليأوت

 الواجهة الثانية لليأوت 


الواجهة Layout 2


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="15dp"
android:background="#8000"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="right"
android:layout_marginLeft="10pt"
android:layout_marginRight="10pt"
android:layout_marginTop="3pt" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right" >
<EditText
android:id="@+id/SX"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
android:ems="10"
android:inputType="numberDecimal"
android:textColor="#ffff" >
<requestFocus />
</EditText>
<TextView
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="الراتب :"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right" >
<EditText
android:id="@+id/SX1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
android:ems="10"
android:inputType="numberDecimal"
android:textColor="#ffff" >
<requestFocus />
</EditText>
<TextView
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="قيمة السعر :"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:gravity="right"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/Y1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium" />
android:textColor="#ffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="المتوفر من الراتب :"
android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="#ffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right" >
<TextView
android:id="@+id/Y2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium" />
android:textColor="#ffff"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="المصروف منه :"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffff" />
</LinearLayout>
<Button
android:id="@+id/enter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="حساب"
android:textColor="#ffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ic_launcher"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
public class Java1 extends Activity{
EditText SX,SX1;
TextView Y1,Y2;
Button enter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.page1);
SX = (EditText) findViewById(R.id.SX);
SX1 = (EditText) findViewById(R.id.SX1);
Y1 = (TextView) findViewById(R.id.Y1);
Y2 = (TextView) findViewById(R.id.Y2);
enter = (Button)findViewById(R.id.enter);
enter.setOnClickListener(new View.OnClickListener() {
<TextView
public void onClick(View v) {
float msroof_mnh,mtwfer_rateeb,al_s3er;
float al_rateeb = 0;
float al_msroof = 0;
al_rateeb = Float.parseFloat(SX.getText().toString());
al_s3er = Float.parseFloat(SX1.getText().toString());
mtwfer_rateeb = al_rateeb - al_s3er;
msroof_mnh = al_msroof + al_s3er;
Y1.setText(""+mtwfer_rateeb+"");
Y2.setText(""+msroof_mnh+"");
}
});
}
}
testApp2
<?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"
tools:context="net.simplifiedlearning.customlistviewandroid.MainActivity">
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<GridView
android:id="@+id/gdV6"
android:layout_width="370dp"
android:layout_height="match_parent"
android:numColumns="3" >
</GridView>
<GridView
android:id="@+id/gdV1"
android:layout_width="370dp"
android:layout_height="match_parent"
android:numColumns="3" >
</GridView>
<GridView
android:id="@+id/gdV3"
android:layout_width="370dp"
android:layout_height="match_parent"
android:numColumns="3" >
</GridView>
<GridView
android:id="@+id/gdV5"
android:layout_width="370dp"
android:layout_height="match_parent"
android:numColumns="3" >
</GridView>
<GridView
android:id="@+id/gdV2"
android:layout_width="370dp"
android:layout_height="match_parent"
android:numColumns="3" >
</GridView>
<GridView
android:id="@+id/gdV4"
android:layout_width="370dp"
android:layout_height="match_parent"
android:numColumns="3" >
</GridView>
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
Page2
<?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" >
<ImageView
android:id="@+id/image_ph"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="top"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp" />
<TextView
android:id="@+id/text_ph"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:textSize="25sp" />
</LinearLayout>

عودة إلى القائمة الرئيسية
اعلان 1
اعلان 2

0 التعليقات :

إرسال تعليق

عربي باي