Java源码示例:com.github.aakira.expandablelayout.ExpandableRelativeLayout
示例1
private void findViews() {
toolbar = (Toolbar) findViewById(R.id.air_toolbar);
inputTitle = (TextInputEditText) findViewById(R.id.air_inputTitle);
inputDescription = (TextInputEditText) findViewById(R.id.air_inputDescription);
textDeviceInfo = (TextView) findViewById(R.id.air_textDeviceInfo);
buttonDeviceInfo = (ImageButton) findViewById(R.id.air_buttonDeviceInfo);
layoutDeviceInfo = (ExpandableRelativeLayout) findViewById(R.id.air_layoutDeviceInfo);
inputUsername = (TextInputEditText) findViewById(R.id.air_inputUsername);
inputPassword = (TextInputEditText) findViewById(R.id.air_inputPassword);
inputEmail = (TextInputEditText) findViewById(R.id.air_inputEmail);
optionUseAccount = (RadioButton) findViewById(R.id.air_optionUseAccount);
optionAnonymous = (RadioButton) findViewById(R.id.air_optionAnonymous);
layoutLogin = (ExpandableRelativeLayout) findViewById(R.id.air_layoutLogin);
layoutAnonymous = (ExpandableRelativeLayout) findViewById(R.id.air_layoutGuest);
buttonSend = (FloatingActionButton) findViewById(R.id.air_buttonSend);
}
示例2
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_expandable_layout);
getSupportActionBar().setTitle(ExpandableLayoutActivity.class.getSimpleName());
mExpandButton = (Button) findViewById(R.id.expandButton);
mMoveChildButton = (Button) findViewById(R.id.moveChildButton);
mMoveChildButton2 = (Button) findViewById(R.id.moveChildButton2);
mMoveTopButton = (Button) findViewById(R.id.moveTopButton);
mSetCloseHeightButton = (Button) findViewById(R.id.setCloseHeightButton);
mExpandLayout = (ExpandableRelativeLayout) findViewById(R.id.expandableLayout);
mExpandButton.setOnClickListener(this);
mMoveChildButton.setOnClickListener(this);
mMoveChildButton2.setOnClickListener(this);
mMoveTopButton.setOnClickListener(this);
mSetCloseHeightButton.setOnClickListener(this);
}
示例3
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_example_read_more);
getSupportActionBar().setTitle(ExampleReadMoreActivity.class.getSimpleName());
mExpandButton = (Button) findViewById(R.id.expandButton);
mExpandLayout = (ExpandableRelativeLayout) findViewById(R.id.expandableLayout);
mOverlayText = (TextView) findViewById(R.id.overlayText);
mExpandButton.setOnClickListener(this);
mGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
mExpandLayout.move(mOverlayText.getHeight(), 0, null);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
mOverlayText.getViewTreeObserver().removeGlobalOnLayoutListener(mGlobalLayoutListener);
} else {
mOverlayText.getViewTreeObserver().removeOnGlobalLayoutListener(mGlobalLayoutListener);
}
}
};
mOverlayText.getViewTreeObserver().addOnGlobalLayoutListener(mGlobalLayoutListener);
}
示例4
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_example_search);
getSupportActionBar().setTitle(ExampleSearchActivity.class.getSimpleName());
mExpandButton = (Button) findViewById(R.id.expandButton);
mExpandLayout = (ExpandableRelativeLayout) findViewById(R.id.expandableLayout);
mExpandButton.setOnClickListener(this);
final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
recyclerView.addItemDecoration(new DividerItemDecoration(this));
recyclerView.setLayoutManager(new LinearLayoutManager(this));
final ArrayList data = new ArrayList();
for(int i = 0; i < 15; i++) {
data.add("Result");
}
recyclerView.setAdapter(new ExampleSearchRecyclerAdapter(data));
}