How do I create a flexible header space with text / edittext instead of an image?
I would like to create an application that has an interface similar to the picture below.
I have already looked at the following library ManuelPeinado / FadingActionBar , ksoichiro / Android-ObservableScrollView , kmshack / Android-ParallaxHeaderViewPager , flavienlaurent / NotBoringActionBar , and none of them have this ability to add a combination
EditText
,Textview
andImageView
.
The play store already has an app that has similar functionality .
Also what is the official name for the colored part of the purple ?
I am completely frustrated as I cannot find tutorials
or libraries
to help me with my project.
Any help is appreciated!
source to share
You can add views directly to the toolbar as a view group. Then you just set it as supportActionBar
styles.xml code
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="windowActionBar">false</item>
</style>
Main layout:
<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="match_parent"
tools:context=".MainActivity">
customizable toolbar layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/holo_red_dark">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/abc_ic_menu_moreoverflow_mtrl_alpha"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="Enter Text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textview"
android:text="Hello world"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
Primary activity:
package com.example.ppoborca.testers;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class MainActivity extends ActionBarActivity {
private Toolbar mToolbar;
private TextView mTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mTextView = (TextView) mToolbar.findViewById(R.id.textview);
mTextView.setText("This worked!");
setSupportActionBar(mToolbar);
}
}
source to share
After searching the web for 4 days I finally found this example on github which is very easy to use and there is this blogspot which explains all the code line by line.
source to share