标签:conda tst intent example etc amp col tco ext
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/LinearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_height="0dp" android:layout_width="fill_parent" android:background="#ADFF2F" android:orientation="horizontal" android:layout_weight="3"> <LinearLayout android:layout_width="0dp" android:layout_height="fill_parent" android:background="#ADFF2F" android:layout_weight="4" android:orientation="vertical"> <Button android:id="@+id/output" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAllCaps="false" android:text="Output"/> <Button android:id="@+id/check" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAllCaps="false" android:text="Check"/> <Button android:id="@+id/go" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAllCaps="false" android:text="Go!"/> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="fill_parent" android:background="#778899" android:orientation="vertical" android:layout_weight="6"> <CheckBox android:id="@+id/import1" android:layout_width="wrap_content" android:layout_height="0dp" android:text="Import ADB Data" android:layout_weight="1"/> <CheckBox android:id="@+id/import2" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" android:text="Import Bandicoot Data" /> <CheckBox android:id="@+id/import3" android:layout_width="wrap_content" android:layout_height="0dp" android:text="Import Other Data" android:layout_weight="1"/> </LinearLayout> </LinearLayout> <LinearLayout android:layout_height="0dp" android:layout_width="fill_parent" android:background="#DA70D6" android:orientation="vertical" android:layout_weight="6"> <TextView android:id="@+id/textview" android:layout_width="match_parent" android:layout_height="match_parent" android:text="Loading..........................." /> </LinearLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="0dp" android:background="#191970" android:layout_weight="1"> <Button android:id="@+id/Clear" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/Save" android:layout_alignBottom="@+id/Save" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:text="Clear Log" android:textAllCaps="false" /> <Button android:id="@+id/Save" android:text="Save Log" android:textAllCaps="false" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout> </LinearLayout>
package com.example.wanggongsheng.uilayouttest; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button output = (Button)findViewById(R.id.output); Button check = (Button)findViewById(R.id.check); Button go = (Button)findViewById(R.id.go); final TextView textview = (TextView)findViewById(R.id.textview); Button clear = (Button)findViewById(R.id.Clear); Button save = (Button)findViewById(R.id.Save); CheckBox import1=(CheckBox)findViewById(R.id.import1); CheckBox import2=(CheckBox)findViewById(R.id.import2); CheckBox import3=(CheckBox)findViewById(R.id.import3); import1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { String data = textview.getText().toString(); data = data + "\nImport ADB Data......."; textview.setText(data); } }); import2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { String data = textview.getText().toString(); data = data + "\nImport BC Data......."; textview.setText(data); } }); import3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { String data = textview.getText().toString(); data = data + "\nImport Other Data......."; textview.setText(data); } }); output.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this,SecondActivity.class); startActivity(intent); } }); check.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this,SecondActivity.class); startActivity(intent); } }); go.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this,SecondActivity.class); startActivity(intent); } }); clear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { textview.setText(""); } }); save.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(MainActivity.this,"功能没有实现",Toast.LENGTH_SHORT).show(); } }); } }
<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout 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="com.example.wanggongsheng.uilayouttest.SecondActivity"> <TextView android:layout_width="wrap_content" android:text="目前这部分没有完成。" android:textSize="24sp" android:layout_height="wrap_content" /> </android.support.constraint.ConstraintLayout>
标签:conda tst intent example etc amp col tco ext
原文地址:https://www.cnblogs.com/zuimeiyujianni/p/8819540.html