Skip to content

Instantly share code, notes, and snippets.

Avatar

Teeranai.P minibugdev

  • Bangkok, Thailand
View GitHub Profile
View AndroidMarqueeAnimationActivity.kt
val marquee = AnimationUtils.loadAnimation(context, R.anim.marquee)
textView.startAnimation(marquee)
View viewstub_ex.kt
viewStub.setVisibility(View.VISIBLE);
// หรือ
val layoutBannedUser: View = viewStub.inflate();
View viewstub_usage.kt
class UserActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
.
.
if(user.isBanned()) {
stub.inflate()
}
View activity_user_viewstub.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageview_avatar"
android:layout_width="150dp"
android:layout_height="150dp"
View banned_user.xml
<?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="#CC000000"
android:gravity="center"
android:orientation="vertical">
<TextView
View activity_user_overlay.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout>
<ImageView />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#CC000000"
android:gravity="center"
android:orientation="vertical">
View activity_user.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageview_avatar"
android:layout_width="150dp"
android:layout_height="150dp"
View viewstub_ex.xml
<ViewStub android:id="@+id/stub"
android:inflatedId="@+id/layout_banned_user"
android:layout="@layout/banned_user"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
View google-direction-api-response.json
{
"formatted_address": "กรุงเทพมหานคร ประเทศไทย",
"name": "กรุงเทพมหานคร",
"types": [
"locality",
"political"
],
"routes": [
{
"distance": {
View RecyclerViewWithController.kt
val controller = MyController().apply{
banners = getBanners(),
productItems = getPromotionProducts()
}
recyclerView.layoutManager = LinearLayoutManager(this)
recyclerView.setHasFixedSize(false)
recyclerView.setController(controller)